:root {
  --qs-bg: #f4f6f8;
  --qs-surface: #ffffff;
  --qs-soft: #f8fafb;
  --qs-text: #17212b;
  --qs-muted: #66727f;
  --qs-border: #dfe4e8;
  --qs-primary: #0d6b59;
  --qs-primary-dark: #095246;
  --qs-primary-soft: #e6f3ef;
  --qs-danger: #b83939;
  --qs-danger-soft: #fdeaea;
  --qs-warning: #a76312;
  --qs-warning-soft: #fff3dc;
  --qs-success: #257a55;
  --qs-success-soft: #e7f4ed;
  --qs-sidebar: #101a22;
  --qs-sidebar-muted: #8f9aa4;
  --qs-shadow: 0 8px 24px rgba(23, 33, 43, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--qs-bg);
  color: var(--qs-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: 260px;
  flex-direction: column;
  overflow-y: auto;
  background: var(--qs-sidebar);
  color: #fff;
}

.sidebar__brand {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 14px 18px;
}

.brand__mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 11px;
  background: var(--qs-primary);
  font-size: 20px;
  font-weight: 800;
}

.brand__copy { display: flex; flex-direction: column; }
.brand__name { font-size: 16px; font-weight: 750; }
.brand__product {
  margin-top: 4px;
  color: var(--qs-sidebar-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .18em;
}

.sidebar__nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 17px 12px;
}

.sidebar__section-label {
  margin: 17px 11px 7px;
  color: var(--qs-sidebar-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 0 12px;
  color: #b9c2ca;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-align: left;
}

.nav-link:hover,
.nav-link--active {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.nav-link__icon {
  display: grid;
  width: 22px;
  place-items: center;
  color: #8c9aa5;
  font-size: 17px;
}

.sidebar__footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  padding: 10px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--qs-primary);
  font-size: 11px;
  font-weight: 750;
}

.user-card__copy { display: flex; flex-direction: column; }
.user-card__copy strong { font-size: 12px; }
.user-card__copy span {
  margin-top: 3px;
  color: var(--qs-sidebar-muted);
  font-size: 10px;
}

.app-main {
  min-height: 100vh;
  margin-left: 260px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--qs-border);
  background: rgba(255,255,255,.97);
  padding: 12px 28px;
  backdrop-filter: blur(14px);
}

.topbar__title { display: flex; flex-direction: column; }
.topbar__title strong { font-size: 13px; }
.topbar__title span {
  margin-top: 4px;
  color: var(--qs-muted);
  font-size: 9px;
}

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

.global-search {
  width: min(330px, 32vw);
  min-height: 42px;
  border: 1px solid var(--qs-border);
  border-radius: 10px;
  background: var(--qs-soft);
  padding: 0 12px;
  outline: 0;
  font-size: 10px;
}

.page-content {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 28px 28px 56px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 15px;
  font-size: 11px;
  font-weight: 700;
}

.button--primary { background: var(--qs-primary); color: #fff; }
.button--primary:hover { background: var(--qs-primary-dark); }
.button--secondary {
  border-color: var(--qs-border);
  background: #fff;
  color: var(--qs-text);
}
.button--danger { background: var(--qs-danger); color: #fff; }
.button--small { min-height: 34px; padding: 0 11px; font-size: 9px; }

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--qs-border);
  border-radius: 10px;
  background: #fff;
  color: var(--qs-text);
}

.panel {
  overflow: hidden;
  border: 1px solid var(--qs-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--qs-shadow);
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--qs-border);
  padding: 16px 17px;
}

.panel__header h2 { margin: 0; font-size: 14px; }
.panel__header p {
  margin: 5px 0 0;
  color: var(--qs-muted);
  font-size: 9px;
}

.legacy-frame-wrap {
  min-height: calc(100vh - 76px);
  padding: 0;
}

.legacy-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 76px);
  border: 0;
  background: var(--qs-bg);
}

.not-found {
  display: grid;
  min-height: 60vh;
  place-items: center;
  text-align: center;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 20px;
}

.modal-layer--open { display: grid; }

.modal-layer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8,14,19,.55);
  backdrop-filter: blur(3px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(7,15,21,.3);
}

.modal-dialog__header,
.modal-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 19px;
}

.modal-dialog__header { border-bottom: 1px solid var(--qs-border); }
.modal-dialog__footer {
  border-top: 1px solid var(--qs-border);
  justify-content: flex-end;
}
.modal-dialog__body {
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  padding: 19px;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 130;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 9px;
}

.toast {
  display: grid;
  grid-template-columns: 30px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--qs-border);
  border-radius: 12px;
  background: #fff;
  padding: 11px;
  box-shadow: 0 14px 40px rgba(23,33,43,.16);
}

.toast__icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--qs-primary-soft);
  color: var(--qs-primary);
  font-weight: 800;
}

.toast__copy strong { display: block; font-size: 10px; }
.toast__copy span {
  display: block;
  margin-top: 3px;
  color: var(--qs-muted);
  font-size: 9px;
}

.toast__close {
  border: 0;
  background: transparent;
  color: var(--qs-muted);
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 220ms ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-main { margin-left: 0; }
}

@media (max-width: 700px) {
  .topbar { padding-inline: 14px; }
  .global-search { width: 42vw; }
  .page-content { padding: 20px 14px 42px; }
}

.sidebar__version {
  padding: 7px 10px 2px;
  color: var(--qs-sidebar-muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}
