:root {
  color: #14181f;
  background: #f5f7f8;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.15fr);
  background: #f5f7f8;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 56px;
  color: #f8fafc;
  background: #16292a;
}

.login-brand h1 { margin: 0 0 8px; font-size: 34px; }
.login-brand p { margin: 0; color: #b9cecc; }
.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #0e2525;
  background: #4ad9c5;
  font-weight: 800;
  font-size: 20px;
}

.brand-mark-small { width: 36px; height: 36px; font-size: 13px; }
.login-panel {
  width: min(420px, calc(100% - 48px));
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 22px;
  padding: 34px;
  background: #fff;
  border: 1px solid #dde3e7;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(19, 38, 43, 0.1);
}

.login-heading { display: flex; gap: 14px; }
.login-heading > svg { width: 30px; color: #148f80; flex: 0 0 auto; }
.login-heading h2 { margin: 0 0 6px; font-size: 22px; }
.login-heading p { margin: 0; color: #68727e; font-size: 14px; line-height: 1.6; }
.login-panel label { display: grid; gap: 8px; color: #4c5864; font-size: 13px; }
.login-panel input,
.table-toolbar input,
.table-toolbar select,
.channel-toolbar input,
.channel-toolbar select,
.channel-dialog input,
.channel-dialog select {
  width: 100%;
  height: 40px;
  border: 1px solid #cfd7dc;
  border-radius: 6px;
  padding: 0 12px;
  color: #171b21;
  background: #fff;
  outline: none;
}

.login-panel input:focus,
.table-toolbar input:focus,
.table-toolbar select:focus,
.channel-toolbar input:focus,
.channel-toolbar select:focus,
.channel-dialog input:focus,
.channel-dialog select:focus { border-color: #148f80; box-shadow: 0 0 0 3px rgba(20, 143, 128, 0.12); }
.primary-button,
.secondary-button,
.pagination button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 650;
}

.primary-button { color: #fff; background: #137d72; }
.primary-button:hover { background: #106c63; }
.primary-button:disabled { cursor: wait; opacity: 0.55; }
.form-error { margin: -6px 0 0; color: #c83d45; font-size: 13px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  color: #dce8e7;
  background: #152728;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand span { margin-top: 3px; color: #94aaa8; font-size: 11px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  color: #c6d6d5;
  background: transparent;
  text-align: left;
}

.nav-item svg { width: 19px; }
.nav-item:hover { color: #fff; background: #203839; }
.nav-item-active { color: #0f2c2a; background: #63ddcb; }
.nav-item-active:hover { color: #0f2c2a; background: #63ddcb; }
.sidebar-account {
  margin-top: auto;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 32px;
  gap: 9px;
  align-items: center;
  padding: 14px 8px 0;
  border-top: 1px solid #294143;
}

.operator-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #152728; background: #f3c563; font-weight: 800; }
.operator-copy { min-width: 0; }
.operator-copy strong, .operator-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operator-copy strong { font-size: 13px; }
.operator-copy span { color: #91a5a4; font-size: 11px; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 5px; color: #b8cbca; background: transparent; }
.icon-button:hover { color: #fff; background: #294143; }
.icon-button svg { width: 18px; }

.workspace { min-width: 0; padding: 28px clamp(22px, 3vw, 44px) 36px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.workspace-header h1 { margin: 0; font-size: 25px; }
.workspace-header p { margin: 6px 0 0; color: #77818b; font-size: 13px; }
.secondary-button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #cfd7dc; color: #36424c; background: #fff; }
.secondary-button:hover { border-color: #93a2aa; }
.secondary-button svg { width: 17px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 14px; }
.metric-card { min-width: 0; min-height: 108px; display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid #dde3e7; border-radius: 8px; background: #fff; }
.metric-card p { margin: 0 0 7px; color: #6f7983; font-size: 12px; }
.metric-card strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 23px; }
.metric-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 7px; flex: 0 0 auto; }
.metric-icon svg { width: 21px; }
.metric-teal { color: #117b70; background: #dff7f2; }
.metric-blue { color: #3867ae; background: #e7effb; }
.metric-violet { color: #7857a7; background: #f0eafb; }
.metric-amber { color: #a66d13; background: #fff0d2; }
.metric-red { color: #b83b44; background: #fde8e8; }

.runtime-summary { margin-top: 18px; min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border: 1px solid #dde3e7; border-radius: 8px; background: #fff; }
.runtime-summary > div:first-child { display: flex; align-items: center; gap: 14px; }
.section-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; color: #245f78; background: #e5f3f8; }
.section-icon svg { width: 21px; }
.runtime-summary h2 { margin: 0 0 5px; font-size: 15px; }
.runtime-summary p { margin: 0; color: #77818b; font-size: 12px; }
.runtime-values { display: grid; gap: 5px; text-align: right; }
.runtime-values span { color: #77818b; font-size: 12px; }
.runtime-alert { color: #c03a43 !important; }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.table-toolbar form { position: relative; width: min(390px, 100%); }
.table-toolbar form svg { position: absolute; top: 11px; left: 12px; width: 17px; color: #7d8790; }
.table-toolbar form input { padding-left: 38px; }
.table-toolbar select { width: 180px; }
.table-toolbar > span { color: #77818b; font-size: 12px; }
.channel-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px auto auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.channel-toolbar form { position: relative; }
.channel-toolbar form svg { position: absolute; top: 11px; left: 12px; width: 17px; color: #7d8790; }
.channel-toolbar form input { padding-left: 38px; }
.channel-toolbar > span { color: #77818b; font-size: 12px; text-align: right; }
.toolbar-action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.toolbar-action svg { width: 17px; }
.table-frame { overflow: auto; border: 1px solid #dde3e7; border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { height: 42px; padding: 0 16px; color: #66717b; background: #f7f9fa; text-align: left; font-size: 11px; font-weight: 650; white-space: nowrap; }
td { min-height: 54px; padding: 12px 16px; border-top: 1px solid #edf0f2; color: #313a43; white-space: nowrap; }
td strong, td small { display: block; }
td small { margin-top: 4px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; color: #89929b; font-size: 10px; }
.table-action { display: inline-flex; align-items: center; gap: 5px; border: 0; color: #126f66; background: transparent; font-weight: 650; }
.table-action:hover { color: #0c514b; }
.table-action svg { width: 16px; }
.empty-cell { height: 160px; color: #89929b; text-align: center; }
.status-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 11px; }
.status-positive { color: #166d58; background: #e1f5ed; }
.status-negative { color: #ae333c; background: #fde9ea; }
.status-warning { color: #8e610f; background: #fff1d2; }
.status-neutral { color: #5f6972; background: #edf0f2; }

.loading-state { min-height: 300px; display: flex; align-items: center; justify-content: center; gap: 9px; color: #78838c; }
.loading-state svg { width: 20px; animation: spin 0.9s linear infinite; }
.error-banner { min-height: 48px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid #f2b8bc; border-radius: 7px; color: #9f2f37; background: #fff1f1; font-size: 13px; }
.error-banner svg { width: 20px; flex: 0 0 auto; }
.error-banner button { margin-left: auto; border: 0; color: #9f2f37; background: transparent; font-weight: 700; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; color: #77818b; font-size: 12px; }
.pagination button { min-height: 34px; border: 1px solid #cfd7dc; color: #35414b; background: #fff; }
.pagination button:disabled { cursor: default; opacity: 0.45; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 24, 28, 0.52);
}
.channel-dialog {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border: 1px solid #d8dfe3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(8, 21, 24, 0.24);
}
.channel-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.channel-dialog h2 { margin: 0 0 6px; font-size: 21px; }
.channel-dialog header p { margin: 0; color: #717c85; font-size: 13px; line-height: 1.55; }
.dialog-close { width: 34px; height: 34px; display: grid; place-items: center; border: 0; color: #69747d; background: transparent; }
.dialog-close svg { width: 22px; }
.channel-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.channel-form-grid label { display: grid; align-content: start; gap: 7px; color: #48535c; font-size: 13px; }
.channel-form-grid label > small { color: #7b858d; font-size: 11px; }
.channel-form-wide { grid-column: 1 / -1; }
.channel-dialog footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid #e5e9eb; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 210px; padding: 34px 24px; }
  .login-panel { margin: 28px auto; }
  .admin-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding-inline: 9px; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-brand > div:last-child, .nav-item span, .operator-copy { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .sidebar-account { grid-template-columns: 1fr; justify-items: center; padding-inline: 0; }
  .workspace { padding: 22px 14px 28px; }
  .workspace-header { align-items: flex-start; }
  .workspace-header p { max-width: 270px; }
  .metric-grid { grid-template-columns: 1fr; }
  .runtime-summary { align-items: flex-start; flex-direction: column; }
  .runtime-values { text-align: left; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .table-toolbar form, .table-toolbar select { width: 100%; }
  .channel-toolbar { grid-template-columns: 1fr; }
  .channel-toolbar > span { text-align: left; }
  .channel-form-grid { grid-template-columns: 1fr; }
  .channel-form-wide { grid-column: auto; }
}
