:root {
  --ink: #172321;
  --muted: #687976;
  --line: #dfe8e5;
  --surface: #ffffff;
  --canvas: #f4f7f6;
  --green: #0b765b;
  --green-dark: #075440;
  --green-soft: #e5f5ef;
  --mint: #6fd0ae;
  --amber: #dc8a28;
  --amber-soft: #fff2de;
  --red: #c74848;
  --red-soft: #fdeaea;
  --blue: #3176b9;
  --blue-soft: #e9f2fb;
  --shadow: 0 18px 50px rgba(22, 55, 46, 0.09);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}
button {
  color: inherit;
}
.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.3;
}
.ambient-one {
  width: 380px;
  height: 380px;
  background: #90e7c7;
  top: -180px;
  right: -80px;
}
.ambient-two {
  width: 300px;
  height: 300px;
  background: #d9eee6;
  bottom: -160px;
  left: -100px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(
      circle at 20% 15%,
      rgba(111, 208, 174, 0.17),
      transparent 32%
    ),
    linear-gradient(135deg, #f8fbfa 0%, #edf5f2 100%);
}

.login-card {
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 80px rgba(7, 84, 64, 0.13);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  font-weight: 850;
  font-size: 21px;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  box-shadow: 0 8px 20px rgba(11, 118, 91, 0.24);
}
.brand strong,
.brand span {
  display: block;
}
.brand strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.brand-login {
  margin-bottom: 48px;
}
.login-heading {
  margin-bottom: 28px;
}
.login-heading h1 {
  margin: 7px 0 10px;
  font-size: 32px;
  letter-spacing: -0.045em;
}
.login-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.eyebrow {
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.eyebrow.light {
  color: #a9ead3;
}

.stack-form,
.form-grid {
  display: grid;
  gap: 18px;
}
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid .span-2 {
  grid-column: span 2;
}
label > span,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: #465a56;
  font-size: 12px;
  font-weight: 700;
}
input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid #cedbd7;
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition:
    border 0.16s,
    box-shadow 0.16s;
}
textarea {
  min-height: 88px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 118, 91, 0.11);
}
input::placeholder,
textarea::placeholder {
  color: #9aa9a5;
}
.password-field {
  position: relative;
}
.password-field input {
  padding-right: 48px;
}
.icon-button {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}
.icon-button:hover {
  background: var(--green-soft);
  color: var(--green);
}
.form-error {
  min-height: 18px;
  margin: -5px 0 0;
  color: var(--red);
  font-size: 12px;
}
.login-footnote {
  margin: 24px 0 0;
  color: #8b9a96;
  text-align: center;
  font-size: 11px;
}

.button {
  min-height: 40px;
  padding: 9px 16px;
  border: 0;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 0.14s,
    box-shadow 0.14s,
    background 0.14s;
}
.button:hover {
  transform: translateY(-1px);
}
.button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}
.button-wide {
  width: 100%;
  min-height: 48px;
}
.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 9px 22px rgba(11, 118, 91, 0.18);
}
.button-primary:hover {
  box-shadow: 0 12px 26px rgba(11, 118, 91, 0.26);
}
.button-secondary {
  border: 1px solid var(--line);
  background: white;
}
.button-secondary:hover,
.button-ghost:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}
.button-ghost {
  color: var(--muted);
  background: transparent;
}
.button-danger {
  color: white;
  background: var(--red);
}
.button-light {
  color: var(--green-dark);
  background: white;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}
.button-small {
  min-height: 32px;
  padding: 6px 11px;
  font-size: 11px;
}
.panel-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.text-button {
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 232px;
  padding: 27px 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #dce7e3;
  background: rgba(250, 252, 251, 0.96);
}
.nav-list {
  display: grid;
  gap: 7px;
  margin-top: 46px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 0;
  border-radius: 11px;
  color: #586965;
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover {
  background: #eef5f2;
  color: var(--ink);
}
.nav-item.active {
  color: var(--green-dark);
  background: var(--green-soft);
}
.nav-icon {
  width: 23px;
  font-size: 17px;
  text-align: center;
}
.sidebar-status {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.sidebar-status strong,
.sidebar-status small {
  display: block;
}
.sidebar-status strong {
  font-size: 11px;
}
.sidebar-status small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #36b37e;
  box-shadow: 0 0 0 4px #dff6eb;
}

.workspace {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  height: 86px;
  padding: 0 34px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid #e0e9e6;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
}
.topbar h1 {
  margin: 3px 0 0;
  font-size: 22px;
  letter-spacing: -0.035em;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.user-chip {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 750;
}
.menu-button {
  display: none;
  border: 0;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}
.content {
  padding: 30px 34px 50px;
}
.page-section {
  display: none;
  animation: section-in 0.22s ease-out;
}
.page-section.active {
  display: block;
}
@keyframes section-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-panel {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 34px 38px;
  overflow: hidden;
  border-radius: 23px;
  color: white;
  background:
    radial-gradient(
      circle at 78% 20%,
      rgba(133, 230, 194, 0.4),
      transparent 32%
    ),
    linear-gradient(135deg, #0b765b 0%, #075440 72%);
  box-shadow: 0 25px 55px rgba(7, 84, 64, 0.18);
}
.hero-panel h2 {
  max-width: 550px;
  margin: 9px 0 9px;
  font-size: clamp(25px, 3vw, 38px);
  letter-spacing: -0.045em;
}
.hero-panel p {
  margin: 0;
  color: #d2eee4;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.metric-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(18, 54, 43, 0.04);
}
.metric-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.metric-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 800;
}
.metric-card strong {
  display: block;
  margin-top: 19px;
  font-size: 28px;
  letter-spacing: -0.04em;
}
.metric-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.two-column {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(18, 54, 43, 0.045);
}
.panel-heading {
  padding: 21px 22px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid #edf2f0;
}
.panel-heading h3 {
  margin: 4px 0 0;
  font-size: 16px;
  letter-spacing: -0.025em;
}
.activity-list {
  padding: 6px 22px 13px;
}
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #edf2f0;
}
.activity-item:last-child {
  border-bottom: 0;
}
.activity-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 850;
}
.activity-main {
  min-width: 0;
  flex: 1;
}
.activity-main strong,
.activity-main small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-main strong {
  font-size: 12px;
}
.activity-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px;
}
.quick-grid button {
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdfc;
  text-align: left;
  cursor: pointer;
}
.quick-grid button:hover {
  border-color: #acd7c7;
  background: var(--green-soft);
}
.quick-grid span,
.quick-grid strong,
.quick-grid small {
  display: block;
}
.quick-grid span {
  margin-bottom: 13px;
  color: var(--green);
  font-size: 20px;
}
.quick-grid strong {
  font-size: 12px;
}
.quick-grid small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.section-toolbar {
  min-height: 52px;
  margin-bottom: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.section-description {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.search-box {
  width: min(410px, 100%);
  position: relative;
}
.search-box span {
  position: absolute;
  top: 10px;
  left: 13px;
  color: var(--muted);
}
.search-box input {
  padding-left: 36px;
  background: white;
}
.table-panel {
  overflow: hidden;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  padding: 13px 17px;
  color: #7d8d89;
  background: #f8faf9;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 15px 17px;
  border-top: 1px solid #edf2f0;
  font-size: 12px;
  vertical-align: middle;
}
tbody tr:hover {
  background: #fbfdfc;
}
.cell-primary strong,
.cell-primary small {
  display: block;
}
.cell-primary strong {
  font-size: 12px;
}
.cell-primary small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active {
  color: #087151;
  background: #e2f6ed;
}
.badge-suspended {
  color: #aa3e3e;
  background: var(--red-soft);
}
.badge-warning {
  color: #a86819;
  background: var(--amber-soft);
}
.badge-neutral {
  color: #566763;
  background: #edf1f0;
}
.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.row-action {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  cursor: pointer;
}
.row-action:hover {
  color: var(--green);
  border-color: #acd7c7;
  background: var(--green-soft);
}
.empty-state {
  padding: 55px 20px;
  color: var(--muted);
  text-align: center;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.plan-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 8px 28px rgba(18, 54, 43, 0.045);
}
.plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.plan-card h3 {
  margin: 5px 0 3px;
  font-size: 19px;
  letter-spacing: -0.035em;
}
.plan-code {
  color: var(--green);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.13em;
}
.plan-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 20px 0;
}
.plan-stat {
  padding: 11px;
  border-radius: 11px;
  background: #f5f8f7;
}
.plan-stat strong,
.plan-stat small {
  display: block;
}
.plan-stat strong {
  font-size: 15px;
}
.plan-stat small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.plan-resources {
  min-height: 39px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}
.plan-card-foot {
  margin-top: 17px;
  padding-top: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #edf2f0;
}
.plan-card-foot small {
  color: var(--muted);
}

.query-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
  gap: 20px;
  align-items: start;
}
.query-config-panel {
  overflow: hidden;
}
.query-form {
  padding: 22px;
}
.query-options {
  display: grid;
  grid-template-columns: 1fr minmax(135px, 0.72fr) 1fr;
  gap: 10px;
  margin: 20px 0 23px;
}
.query-check,
.query-inline-field {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfa;
}
.query-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.query-check input {
  width: 17px;
  min-height: 17px;
  margin: 2px 0 0;
  accent-color: var(--green);
}
.query-check span,
.query-check strong,
.query-check small {
  display: block;
}
.query-check strong {
  font-size: 11px;
}
.query-check small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}
.query-inline-field > span {
  margin-bottom: 7px;
  font-size: 10px;
}
.query-inline-field input {
  min-height: 37px;
  padding: 7px 9px;
}
.query-inline-field input:disabled {
  color: #8b9996;
  background: #edf2f0;
}
.query-filter-section {
  margin-bottom: 14px;
}
.query-filter-empty {
  padding: 16px;
  border-radius: 11px;
  color: var(--muted);
  background: #f5f8f7;
  font-size: 11px;
  text-align: center;
}
.query-info {
  padding: 13px 14px;
  border-radius: 11px;
  color: #315f55;
  background: var(--green-soft);
  font-size: 10px;
  line-height: 1.55;
}
.query-info code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.65);
}
.query-validation {
  margin: 12px 0 0;
}
.query-side {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.limits-panel,
.generated-panel {
  overflow: hidden;
}
.query-limit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 16px;
}
.query-limit-grid div {
  padding: 12px;
  border-radius: 11px;
  background: #f5f8f7;
}
.query-limit-grid strong,
.query-limit-grid small {
  display: block;
}
.query-limit-grid strong {
  font-size: 15px;
}
.query-limit-grid small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.generated-item {
  padding: 15px 17px;
  border-bottom: 1px solid #edf2f0;
}
.generated-item:last-child {
  border-bottom: 0;
}
.generated-label {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.generated-label strong {
  font-size: 11px;
}
.generated-label button {
  padding: 4px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}
.generated-output {
  min-height: auto;
  padding: 10px;
  border-color: #dce7e3;
  border-radius: 9px;
  color: #21463e;
  background: #f8faf9;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  line-height: 1.55;
  resize: vertical;
}
.query-execute-card {
  margin-top: 16px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #cfe5dc;
  border-radius: 13px;
  background: linear-gradient(135deg, #f2faf7, #e7f5ef);
}
.query-execute-card strong,
.query-execute-card small {
  display: block;
}
.query-execute-card strong {
  color: var(--green-dark);
  font-size: 12px;
}
.query-execute-card small {
  max-width: 470px;
  margin-top: 4px;
  color: #56736b;
  font-size: 9px;
  line-height: 1.5;
}
.query-execute-card .button {
  flex: 0 0 auto;
}
.query-preview-panel {
  margin-top: 20px;
  overflow: hidden;
}
.query-preview-loading,
.query-preview-error {
  min-height: 150px;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.query-preview-loading strong,
.query-preview-loading small {
  display: block;
}
.query-preview-loading small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
.preview-spinner {
  width: 25px;
  height: 25px;
  border: 3px solid #d9ece5;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: preview-spin 0.8s linear infinite;
}
@keyframes preview-spin {
  to {
    transform: rotate(360deg);
  }
}
.query-preview-error {
  color: #802f35;
  background: #fff8f8;
}
.query-preview-error > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--red);
  font-weight: 850;
}
.query-preview-error p {
  margin: 5px 0 0;
  font-size: 10px;
}
.query-preview-heading {
  align-items: flex-start;
}
.query-preview-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9px;
}
.query-preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}
.query-preview-metrics {
  padding: 15px 18px;
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
  gap: 8px;
  border-bottom: 1px solid #edf2f0;
  background: #fbfcfc;
}
.query-preview-metrics div {
  padding: 10px;
  border-radius: 10px;
  background: white;
  box-shadow: 0 2px 10px rgba(23, 63, 52, 0.05);
}
.query-preview-metrics strong,
.query-preview-metrics small {
  display: block;
}
.query-preview-metrics strong {
  color: var(--green-dark);
  font-size: 13px;
}
.query-preview-metrics small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}
.query-preview-table-wrap {
  max-height: 590px;
  overflow: auto;
}
.query-preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.query-preview-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  color: #3f5f56;
  background: #f0f6f3;
  box-shadow: 0 1px 0 #dfeae6;
}
.query-preview-table td {
  min-width: 120px;
  max-width: 280px;
  vertical-align: top;
  color: #294a42;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.query-preview-table tbody tr:nth-child(even) td {
  background: #fbfdfc;
}
.preview-null {
  color: #9aaaa5;
  font-style: italic;
}
.preview-complex summary {
  color: var(--green);
  cursor: pointer;
  font-weight: 750;
}
.preview-complex pre {
  max-height: 220px;
  margin: 7px 0 0;
  padding: 8px;
  overflow: auto;
  border-radius: 7px;
  color: #31534a;
  background: #eef5f2;
  white-space: pre-wrap;
}
.query-preview-empty {
  padding: 50px 24px;
  color: var(--muted);
  text-align: center;
}
.query-preview-pagination {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid #edf2f0;
}
.query-preview-pagination > span {
  color: var(--muted);
  font-size: 9px;
}
.query-preview-pagination > div {
  display: flex;
  align-items: center;
  gap: 9px;
}
.query-preview-pagination strong {
  min-width: 52px;
  text-align: center;
  font-size: 10px;
}
.query-preview-footnote {
  padding: 12px 18px;
  border-top: 1px solid #edf2f0;
  color: #5f756f;
  background: #f8faf9;
  font-size: 9px;
  line-height: 1.5;
}

.modal-backdrop,
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(18, 35, 31, 0.48);
  backdrop-filter: blur(5px);
}
.modal {
  width: min(720px, 100%);
  max-height: min(820px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  background: white;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.22);
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal-header {
  padding: 21px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 {
  margin: 4px 0 0;
  font-size: 21px;
  letter-spacing: -0.035em;
}
.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: #f2f5f4;
  font-size: 22px;
  cursor: pointer;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
}
.form-section {
  margin: 3px 0 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.form-section:last-of-type {
  border-bottom: 0;
}
.form-section h4 {
  margin: 0 0 5px;
  font-size: 13px;
}
.form-section > p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}
.field-help {
  margin-top: 5px;
  color: #8a9995;
  font-size: 9px;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
}
.switch {
  position: relative;
  width: 40px;
  height: 22px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd6d3;
  cursor: pointer;
  transition: 0.18s;
}
.switch span::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: white;
  transition: 0.18s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.switch input:checked + span {
  background: var(--green);
}
.switch input:checked + span::after {
  transform: translateX(18px);
}
.resource-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  padding: 4px;
}
.resource-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 10px;
}
.resource-check input {
  width: 15px;
  min-height: 15px;
  accent-color: var(--green);
}
.token-box {
  padding: 16px;
  border: 1px dashed #8bcab5;
  border-radius: 13px;
  color: #064b39;
  background: var(--green-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.6;
  word-break: break-all;
}
.notice {
  margin-bottom: 15px;
  padding: 12px 14px;
  border-radius: 11px;
  color: #7a531e;
  background: var(--amber-soft);
  font-size: 11px;
  line-height: 1.5;
}
.result-list {
  display: grid;
  gap: 7px;
}
.result-row {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-radius: 9px;
  background: #f5f8f7;
  font-size: 11px;
}
.filter-manager-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: start;
}
.filter-context-grid {
  margin-bottom: 16px;
}
.filter-guidance {
  margin-bottom: 16px;
  padding: 13px 15px;
  display: grid;
  gap: 5px;
  border-radius: 11px;
  color: #175747;
  background: var(--green-soft);
  font-size: 10px;
  line-height: 1.55;
}
.filter-rows {
  display: grid;
  gap: 10px;
}
.filter-row {
  padding: 13px;
  display: grid;
  grid-template-columns:
    minmax(150px, 0.8fr) minmax(190px, 1fr) minmax(160px, 0.8fr)
    auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfc;
}
.filter-row label {
  display: grid;
  gap: 6px;
}
.filter-row label > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}
.filter-row input,
.filter-row select,
.column-search {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: white;
  font: inherit;
  font-size: 10px;
}
.filter-row-actions {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.danger-text {
  color: var(--red);
}
.filter-locked {
  padding: 6px 8px;
  border-radius: 999px;
  color: #8a5a10;
  background: var(--amber-soft);
  font-size: 8px;
  white-space: nowrap;
}
.filter-actions {
  justify-content: space-between;
}
.filter-actions > span {
  color: var(--muted);
  font-size: 10px;
}
.columns-panel {
  position: sticky;
  top: 96px;
}
.column-search {
  margin: 12px 0;
}
.column-catalog {
  max-height: 520px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  overflow: auto;
}
.column-chip {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #31554b;
  background: #f6faf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  cursor: pointer;
}
.column-chip:hover {
  border-color: #7cc3ad;
  background: var(--green-soft);
}
.resource-column-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 520px;
}
.resource-column-list .column-chip {
  cursor: default;
}
.table-panel code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #31554b;
  background: #f6faf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
}
.confirm-card {
  width: min(390px, 100%);
  padding: 29px;
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow);
  text-align: center;
}
.confirm-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--red);
  background: var(--red-soft);
  font-weight: 900;
}
.confirm-card h3 {
  margin: 0 0 8px;
}
.confirm-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: grid;
  gap: 9px;
}
.toast {
  width: min(360px, calc(100vw - 40px));
  padding: 13px 15px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease-out;
}
.toast-success {
  border-left: 4px solid var(--green);
}
.toast-error {
  border-left: 4px solid var(--red);
}
.toast strong,
.toast small {
  display: block;
}
.toast strong {
  font-size: 11px;
}
.toast small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(15px);
  }
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .plan-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-column {
    grid-template-columns: 1fr;
  }
  .query-builder-grid {
    grid-template-columns: 1fr;
  }
  .query-preview-metrics {
    grid-template-columns: repeat(4, 1fr);
  }
  .filter-manager-grid {
    grid-template-columns: 1fr;
  }
  .columns-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.2s;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.12);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .workspace {
    width: 100%;
  }
  .menu-button {
    display: block;
  }
  .topbar {
    height: 76px;
    padding: 0 17px;
  }
  .topbar-actions .user-chip {
    display: none;
  }
  .content {
    padding: 20px 15px 40px;
  }
  .hero-panel {
    min-height: 225px;
    padding: 27px;
    align-items: flex-start;
    flex-direction: column;
  }
  .metric-grid,
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .section-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .section-toolbar .button {
    width: 100%;
  }
  .search-box {
    width: 100%;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: auto;
  }
  .resource-picker {
    grid-template-columns: repeat(2, 1fr);
  }
  .query-options {
    grid-template-columns: 1fr;
  }
  .query-execute-card,
  .query-preview-heading,
  .query-preview-pagination {
    align-items: stretch;
    flex-direction: column;
  }
  .query-execute-card .button {
    width: 100%;
  }
  .query-preview-actions {
    justify-content: flex-start;
  }
  .query-preview-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-row {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 29px 23px;
  }
  .brand-login {
    margin-bottom: 35px;
  }
}
