:root {
  --app-primary: #0d6efd;
  --app-border: #dfe3e8;
  --app-surface: #ffffff;
  --app-background: #eef1f4;
  --app-muted: #66707c;
}

body {
  min-width: 320px;
  color: #252b33;
  background: var(--app-background);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}

.app-container {
  max-width: 1180px;
}

.app-navbar {
  min-height: 65px;
  border-bottom: 1px solid #15181c;
  background: #20242a;
}

.app-navbar .navbar-brand {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.app-navbar .navbar-brand:hover,
.app-navbar .navbar-brand:focus {
  color: #fff;
}

.app-brand-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  object-fit: contain;
}

.auth-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.app-navbar .nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  color: #c9ced4;
  border-radius: 5px;
}

.app-navbar .navbar-nav {
  gap: 12px;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.app-main {
  padding-top: 24px;
}

.app-shell {
  padding: 28px 30px 36px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: var(--app-surface);
  box-shadow: 0 6px 20px rgba(27, 36, 45, 0.05);
}

.app-footer {
  padding: 16px 0;
}

.app-footer-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6f7882;
  font-size: 13px;
}

.app-footer-separator {
  margin: 0 9px;
  color: #b0b7bf;
}

.app-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #4f5964;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.app-footer-link:hover,
.app-footer-link:focus {
  color: var(--app-primary);
  text-decoration: underline;
}

@media (min-width: 768px) {
  .app-main {
    display: flex;
    padding-bottom: 16px;
  }

  .app-main > .app-container {
    display: flex;
  }

  .logs-main {
    min-height: 0;
    flex: 1 1 0 !important;
  }

  .create-vm-main {
    min-height: 0;
    flex: 1 1 0 !important;
  }

  .logs-main > .app-container,
  .create-vm-main > .app-container {
    min-height: 0;
  }

  .app-shell {
    width: 100%;
  }

  .logs-shell {
    display: flex;
    min-height: 0;
    flex-direction: column;
  }

  .logs-shell .logs-table {
    min-height: 0;
    overflow: auto;
    flex: 1 1 auto;
  }

  .logs-shell .logs-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .logs-shell .table-footer {
    flex: 0 0 auto;
  }

  .create-vm-shell {
    min-height: 0;
    overflow: auto;
  }

  .app-footer {
    padding-top: 0;
  }
}

.app-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0;
}

.app-page-subtitle {
  margin: 5px 0 0;
  color: var(--app-muted);
}

.app-actions,
.action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-group {
  flex-wrap: nowrap;
}

.action-group form {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 5px;
  font-weight: 500;
}

.form-label {
  margin-bottom: 7px;
  color: #343b44;
  font-weight: 600;
}

.app-form-grid {
  --bs-gutter-x: 12px;
  --bs-gutter-y: 12px;
}

.form-control,
.form-select,
.input-group-text {
  min-height: 40px;
  border-color: #d8dde3;
  border-radius: 5px;
}

.input-group-text {
  color: #737d89;
  background: #f8f9fa;
}

.form-control:focus,
.form-select:focus {
  border-color: #70ad8f;
  box-shadow: 0 0 0 0.2rem rgba(23, 107, 69, 0.13);
}

.table-panel {
  overflow-x: auto;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: #fff;
}

.table-panel .table {
  margin: 0;
}

.table-panel thead th {
  padding: 11px 14px;
  color: #58616c;
  background: #f6f7f9;
  border-bottom: 1px solid var(--app-border);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.table-panel tbody td {
  padding: 12px 14px;
  border-color: #e9ecef;
  vertical-align: middle;
}

.table-panel tbody tr:last-child td {
  border-bottom: 0;
}

.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: #fafbfc;
}

.account-table table {
  min-width: 760px;
}

.account-table tbody td,
.logs-table tbody td {
  font-size: 14px;
  line-height: 1.5;
}

.account-table code {
  font-size: inherit;
  overflow-wrap: normal;
  white-space: nowrap;
}

.log-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.log-filter-field {
  flex: 0 0 auto;
}

.log-filter-form .form-control,
.log-filter-form .form-select {
  min-height: 32px;
}

@media (min-width: 768px) {
  .log-filter-form {
    align-items: center;
  }

  .log-filter-field {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .log-filter-field .form-label {
    margin-bottom: 0;
    white-space: nowrap;
  }

  .log-filter-status .form-select {
    width: 160px;
  }

  .log-filter-account .form-select {
    width: 260px;
  }

  .log-filter-search .form-control {
    width: 220px;
  }
}

@media (min-width: 992px) {
  .log-filter-form {
    flex-wrap: nowrap;
  }

  .log-filter-search {
    min-width: 0;
    flex: 1 1 0;
  }

  .log-filter-search .form-control {
    width: 100%;
    min-width: 0;
  }

  .log-filter-form .filter-actions {
    margin-left: auto;
    flex: 0 0 auto;
  }
}

.logs-table table {
  width: 100%;
  min-width: 1040px;
  table-layout: fixed;
}

.logs-table .log-account-col {
  width: 260px;
}

.logs-table .log-action-col {
  width: 150px;
}

.logs-table .log-vm-col {
  width: 80px;
}

.logs-table .log-duration-col {
  width: 150px;
}

.logs-table .log-time-col {
  width: auto;
}

.logs-table .log-status-col {
  width: 100px;
}

.logs-table .log-detail-col {
  width: 110px;
}

.logs-table .log-account-column {
  width: 260px;
  max-width: 260px;
}

.log-account-value,
.log-vm-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logs-table th:nth-child(4),
.logs-table td:nth-child(4),
.logs-table th:nth-child(6),
.logs-table td:nth-child(6),
.logs-table th:nth-child(7),
.logs-table td:nth-child(7) {
  text-align: center;
}

.vm-table-scroll {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.vm-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.vm-table th,
.vm-table td {
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
}

.vm-table .vm-name-col {
    width: 121px;
}

.vm-table .vm-ip-col {
    width: 180px;
}

.vm-table .vm-location-col {
    width: 130px;
}

.vm-table .vm-size-col {
    width: auto;
}

.vm-table .vm-status-col {
    width: 150px;
}

.vm-status-column .text-danger {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.vm-table .vm-actions-col {
    width: 294px;
}

.vm-name {
  display: block;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

.vm-action-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.vm-action-group form {
  margin: 0;
}

.vm-action-button {
  min-height: 32px;
  padding-right: 9px;
  padding-left: 9px;
  white-space: nowrap;
}

.actions-column {
  width: 1%;
  white-space: nowrap;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--app-muted);
  flex-wrap: wrap;
}

.pagination {
  --bs-pagination-color: #3f4852;
  --bs-pagination-hover-color: var(--app-primary);
  --bs-pagination-focus-color: var(--app-primary);
  --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.13);
  --bs-pagination-disabled-color: #69737e;
  --bs-pagination-active-bg: var(--app-primary);
  --bs-pagination-active-border-color: var(--app-primary);
}

.page-link {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 5px;
}

.pagination-summary,
.pagination-controls,
.page-jump {
  display: flex;
  align-items: center;
}

.pagination-summary,
.pagination-controls {
  gap: 16px;
}

.page-size-select {
  width: auto;
  min-width: 108px;
  min-height: 34px;
}

.pagination-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pagination-controls .page-link {
  min-width: 36px;
  justify-content: center;
}

.page-jump {
  gap: 8px;
  white-space: nowrap;
}

.page-jump .form-control {
  width: 64px;
  min-height: 34px;
  text-align: center;
}

.status-badge {
  color: #4f5863;
  background: #edf0f2;
  border: 1px solid #dfe3e7;
  font-size: inherit;
  white-space: nowrap;
}

.vm-status-运行中 {
  color: #176b45;
  background: #e6f5ed;
  border-color: #b9ddc9;
}

.vm-status-启动中 {
  color: #145a8d;
  background: #e8f3fb;
  border-color: #bed9eb;
}

.vm-status-停止中,
.vm-status-释放中 {
  color: #8a5a00;
  background: #fff4d6;
  border-color: #ead49a;
}

.vm-status-已停止,
.vm-status-已停止并释放 {
  color: #4f5863;
  background: #edf0f2;
  border-color: #d6dce1;
}

.vm-status-读取失败 {
  color: #a3231a;
  background: #fff0ee;
  border-color: #efc3bd;
}

.vm-status-未知 {
  color: #68727d;
  background: #f5f6f7;
  border-color: #e1e4e7;
}

.status-成功 {
  color: #176b45;
  background: #e6f5ed;
  border-color: #c5e5d3;
}

.status-失败,
.status-中断 {
  color: #9b1c14;
  background: #fff0ee;
  border-color: #f0cbc6;
}

.status-排队中,
.status-执行中 {
  color: #725300;
  background: #fff4d6;
  border-color: #ead9a3;
}

.task-detail-column {
  white-space: nowrap;
}

.task-detail {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}

.empty-state {
  padding: 40px !important;
  color: var(--app-muted) !important;
  text-align: center;
}

.cost-toolbar {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 14px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: #f8f9fa;
}

.cost-account-form,
.cost-subscription {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cost-account-form .form-label,
.cost-subscription > span {
  flex: 0 0 auto;
  font-size: 14px;
  white-space: nowrap;
}

.cost-account-form .form-label {
  margin-bottom: 0;
}

.cost-account-form .form-select {
  width: 280px;
  min-height: 32px;
}

.cost-subscription {
  min-width: 0;
  font-size: 14px;
}

.cost-subscription code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-student-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.cost-loading-state,
.cost-error-state,
.cost-empty-state,
.cost-unavailable-state {
  display: flex;
  min-height: 280px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--app-muted);
  text-align: center;
}

.cost-error-state,
.cost-empty-state,
.cost-unavailable-state {
  flex-direction: column;
}

.cost-error-state > .bi,
.cost-empty-state > .bi {
  margin-bottom: 4px;
  font-size: 38px;
}

.cost-unavailable-state {
  max-width: 660px;
  margin: 0 auto;
  padding: 42px 20px;
}

.cost-unavailable-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: #0a58ca;
  background: #e7f1ff;
  border-radius: 50%;
  font-size: 24px;
}

.cost-unavailable-state h2 {
  margin: 4px 0 2px;
  color: #303842;
  font-size: 19px;
}

.cost-unavailable-state p {
  margin: 0;
  color: var(--app-muted);
  line-height: 1.65;
}

.cost-unavailable-state .btn {
  margin-top: 8px;
}

.cost-empty-state h2 {
  margin: 0;
  color: #303842;
  font-size: 18px;
}

.cost-empty-state p {
  max-width: 600px;
  margin: 0;
}

.cost-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.cost-summary-card {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: #fff;
}

.cost-summary-label {
  margin-bottom: 9px;
  color: var(--app-muted);
  font-size: 13px;
}

.cost-summary-value {
  overflow: hidden;
  color: #20262e;
  font-size: 23px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-summary-value small {
  color: #6c7681;
  font-size: 12px;
  font-weight: 600;
}

.cost-date-value {
  font-size: 20px;
}

.cost-summary-hint {
  margin-top: 8px;
  overflow: hidden;
  color: #858e98;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-tabs-panel {
  overflow: hidden;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: #fff;
}

.settings-tabs-scroll {
  overflow-x: auto;
  background: #f8fafc;
}

.settings-tabs {
  min-width: max-content;
  padding: 0 20px;
  border-bottom-color: var(--app-border);
}

.settings-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 15px 18px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #5e6874;
  font-size: 14px;
  font-weight: 600;
}

.settings-tabs .nav-link:hover,
.settings-tabs .nav-link:focus {
  color: var(--app-primary);
}

.settings-tabs .nav-link.active {
  border-bottom-color: var(--app-primary);
  background: transparent;
  color: var(--app-primary);
}

.settings-tab-content {
  padding: 26px;
}

.settings-tab-actions {
  display: flex;
  justify-content: flex-end;
}

.settings-audit-table {
  max-width: 100%;
  overflow: auto;
}

.settings-audit-table table {
  width: 100%;
  min-width: 920px;
  table-layout: fixed;
}

.settings-audit-time-col {
  width: 210px;
}

.settings-audit-account-col {
  width: 150px;
}

.settings-audit-ip-col {
  width: 165px;
}

.settings-audit-result-col {
  width: 110px;
}

.settings-audit-device-col {
  width: auto;
}

.settings-audit-agent {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-vm-shell .form-control,
.create-vm-shell .form-select,
.settings-tabs-panel .form-control,
.settings-tabs-panel .form-select,
.settings-tabs-panel .input-group-text {
  min-height: 34px;
  font-size: 14px;
}

.cost-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: #fff;
}

.cost-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.cost-section-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.cost-section-heading p {
  margin: 4px 0 0;
  color: var(--app-muted);
  font-size: 12px;
}

.cost-line-chart-wrap {
  width: 100%;
  padding-bottom: 4px;
  overflow: hidden;
}

.cost-line-chart {
  display: block;
  width: 100%;
  height: 220px;
}

.cost-chart-grid-line {
  stroke: #e5e9ed;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.cost-chart-zero-line {
  stroke: #aeb7c1;
  stroke-dasharray: 4 4;
}

.cost-chart-line {
  fill: none;
  stroke: var(--app-primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.cost-chart-point {
  fill: #fff;
  stroke: var(--app-primary);
  stroke-width: 2;
  cursor: help;
  vector-effect: non-scaling-stroke;
}

.cost-chart-point:hover,
.cost-chart-point:focus {
  fill: #dbeafe;
  outline: none;
}

.cost-chart-axis-label,
.cost-chart-date-label {
  fill: #737d89;
  font-family: inherit;
  font-size: 11px;
}

.cost-chart-date-label {
  text-anchor: middle;
}

.cost-breakdown-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.cost-table-panel {
  max-width: 100%;
  overflow: auto;
}

.cost-service-table-panel {
  max-height: 266px;
}

.cost-resource-table-panel {
  max-height: 363px;
}

.cost-table-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.cost-table-panel table {
  min-width: 430px;
}

.cost-table-panel tbody td {
  font-size: 13px;
}

.cost-name {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-resource-type {
  display: block;
  max-width: 240px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--app-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-section-empty {
  padding: 38px 12px;
  color: var(--app-muted);
  text-align: center;
}

.auth-panel {
  width: min(420px, 100%);
  margin: 48px auto;
}

.app-toast-container {
  top: 69px;
  right: 16px;
  z-index: 1090;
  padding: 0;
}

.app-toast {
  width: min(360px, calc(100vw - 24px));
  padding: 13px 14px;
  color: #28313a;
  background: #fff;
  border: 1px solid #cee2d7;
  border-left: 3px solid #198754;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.14);
}

.app-toast-icon {
  display: inline-flex;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  color: #157347;
  background: #e8f5ee;
  border-radius: 50%;
}

.app-toast-warning {
  border-color: #f3d5a0;
  border-left-color: #f0ad4e;
}

.app-toast-warning .app-toast-icon {
  color: #9a6200;
  background: #fff4dc;
}

.app-toast .toast-body {
  font-size: 14px;
  line-height: 1.45;
}

.app-toast-close {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px;
  font-size: 11px;
}

.modal-content {
  border: 1px solid var(--app-border);
  border-radius: 7px;
  box-shadow: 0 18px 50px rgba(20, 28, 38, 0.18);
}

.account-modal-dialog {
  max-width: 640px;
}

.account-modal-dialog .form-control {
  min-height: 34px;
  font-size: 14px;
}

@media (max-width: 991.98px) {
  .cost-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.modal-header,
.modal-footer {
  padding: 16px 20px;
}

.modal-body {
  padding: 20px;
}

.empty-view {
  display: flex;
  min-height: 420px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.empty-view-icon {
  margin-bottom: 18px;
  color: #75808b;
  font-size: 48px;
}

.empty-view-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 650;
}

.empty-view-text {
  max-width: 560px;
  margin: 0 0 22px;
  color: var(--app-muted);
}

@media (max-width: 767.98px) {
  .settings-tabs {
    padding: 0 8px;
  }

  .settings-tabs .nav-link {
    padding-right: 13px;
    padding-left: 13px;
  }

  .settings-tab-content {
    padding: 18px;
  }

  .app-container {
    max-width: none;
    padding-right: 12px;
    padding-left: 12px;
  }

  .app-navbar .app-container {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .app-navbar .navbar-collapse {
    padding-top: 8px;
  }

  .app-navbar .navbar-nav {
    gap: 6px;
    padding: 6px 0 2px;
  }

  .app-main {
    padding-top: 0;
  }

  .app-main > .app-container {
    padding: 0;
  }

  .app-shell {
    min-height: calc(100vh - 144px);
    padding: 20px 12px 32px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .app-page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .app-primary-action {
    width: 100%;
  }

  .page-size-form {
    display: none;
  }

  .cost-toolbar,
  .cost-account-form,
  .cost-subscription {
    align-items: stretch;
    flex-direction: column;
  }

  .cost-toolbar {
    gap: 12px;
  }

  .cost-account-form,
  .cost-subscription {
    gap: 6px;
  }

  .cost-account-form .form-select {
    width: 100%;
  }

  .cost-subscription code {
    white-space: normal;
    word-break: break-all;
  }

  .cost-summary-grid,
  .cost-breakdown-grid {
    grid-template-columns: 1fr;
  }

  .cost-summary-grid {
    gap: 10px;
  }

  .app-actions {
    width: 100%;
  }

  .app-actions .btn {
    flex: 1;
  }

  .vm-table {
    width: 760px;
    min-width: 760px;
  }

    .vm-table .vm-name-col {
        width: 116px;
    }

    .vm-table .vm-actions-col {
        width: 170px;
    }

  .vm-action-group {
    gap: 5px;
  }

  .vm-action-button {
    width: 36px;
    min-width: 36px;
    padding-right: 0;
    padding-left: 0;
  }

  .vm-action-label {
    display: none;
  }

  .table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .table-footer .pagination {
    flex-wrap: wrap;
  }

  .filter-actions .app-actions {
    display: flex;
  }

  .log-filter-field,
  .filter-actions {
    width: 100%;
  }

  .app-toast-container {
    top: 75px;
    right: 12px;
    left: 12px;
  }

  .app-toast {
    width: 100%;
  }

  .modal-header,
  .modal-footer,
  .modal-body {
    padding-right: 16px;
    padding-left: 16px;
  }
}
