body {
  background: #f5f7fb;
  color: #1f2937;
  font: 500 14px/1.45 "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}

.app-entry {
  align-items: center;
  display: flex;
  font: 500 16px/1.5 "Helvetica Neue", Arial, sans-serif;
  justify-content: center;
  min-height: 100vh;
}

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

.app-body {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  background: linear-gradient(180deg, #0f172a, #1e293b);
  color: #e2e8f0;
  min-width: 220px;
  padding: 0.9rem 0.65rem;
}

.mobile-sidebar {
  min-width: 100%;
  min-height: 100%;
}

.sidebar-link {
  align-items: center;
  border-radius: 0.75rem;
  color: inherit;
  display: flex;
  font-size: 0.93rem;
  gap: 0.65rem;
  margin-bottom: 0.2rem;
  padding: 0.65rem 0.85rem;
  text-decoration: none;
}

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

.main-content {
  flex: 1;
  padding: 0.875rem 0.875rem 5rem;
}

.page-section {
  min-height: calc(100vh - 80px);
}

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  max-width: 480px;
  width: 100%;
}

.captcha-container {
  background: #fff;
  cursor: pointer;
  min-width: 124px;
  padding: 0;
}

.captcha-container svg {
  display: block;
}

.chat-messages {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  min-height: 360px;
  overflow-y: auto;
  padding: 0.9rem;
}

.ai-session-card {
  min-height: calc(100vh - 88px);
}

#chatSessionList {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.session-item {
  align-items: stretch;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
}

.session-item:hover,
.session-item.active {
  background: #eff6ff;
}

.session-main {
  background: transparent;
  border: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0.25rem;
  text-align: left;
}

.session-actions {
  align-items: center;
  display: flex;
  gap: 0.25rem;
}

.session-action-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0.65rem;
  color: #64748b;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.session-action-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.session-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.session-title {
  color: #0f172a;
  font-weight: 600;
}

.session-time {
  color: #64748b;
  font-size: 0.8rem;
}

.chat-bubble {
  border-radius: 1rem;
  margin-bottom: 0.75rem;
  max-width: 88%;
  padding: 0.75rem 0.9rem;
}

.chat-bubble.user {
  background: #dbeafe;
  margin-left: auto;
}

.chat-bubble.assistant {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.chat-bubble.assistant.streaming {
  border-style: dashed;
}

.chat-bubble.assistant.error {
  background: #fff7ed;
  border-color: #fb923c;
}

.chat-bubble.system {
  background: #fff7ed;
  border: 1px solid #fdba74;
  max-width: 100%;
}

.chat-bubble-head {
  color: #64748b;
  display: flex;
  font-size: 0.8rem;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.chat-bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-empty {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
}

.chat-form-actions {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.page-section > .row {
  --bs-gutter-x: 0.9rem;
  --bs-gutter-y: 0.9rem;
}

.chat-form-actions #modelSelect {
  flex: 0 0 220px;
  max-width: 100%;
}

.chat-form-actions #chatSendBtn {
  flex: 0 0 auto;
}

.list-pager-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  justify-content: space-between;
}

.list-pager-left {
  align-items: center;
  column-gap: 0.625rem !important;
  row-gap: 0.5rem !important;
}

.list-pager-left .form-label {
  color: #64748b;
  font-size: 0.875rem;
}

.list-pager-left .form-select {
  min-width: 4.5rem;
}

.list-pager-left .btn-group .btn {
  white-space: nowrap;
}

.list-pager-left .btn-group {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.list-pager-summary {
  margin-left: auto;
  font-weight: 500;
  white-space: nowrap;
}

.list-page-header {
  margin-bottom: 0.1rem;
}

.list-page-title .h5 {
  font-size: 1rem;
  font-weight: 700;
}

.list-page-toolbar .btn,
.list-page-toolbar .btn-group-sm > .btn {
  --bs-btn-padding-y: 0.32rem;
  --bs-btn-padding-x: 0.72rem;
}

.list-page-card {
  border-radius: 0.9rem;
}

.list-page-filters {
  padding: 0.8rem 0.9rem;
}

.list-page-filters .form-label {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.3rem !important;
}

.list-page-filters .btn {
  --bs-btn-padding-y: 0.32rem;
  --bs-btn-padding-x: 0.72rem;
}

.list-page .card,
.list-page .card-body,
.list-page .card-footer {
  overflow: visible;
}

.list-page .card-footer {
  background: rgba(255, 255, 255, 0.98) !important;
  border-top: 1px solid #dbe3ee;
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
  bottom: 0;
  left: 0;
  padding: 0.6rem 0.9rem;
  position: sticky;
  right: 0;
  z-index: 1020;
  backdrop-filter: blur(8px);
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.05);
}

.list-page .table-responsive {
  overflow-x: auto;
  overflow-y: visible;
}

.app-data-table {
  font-size: 0.92rem;
}

.app-data-table thead th {
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.7rem 0.85rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-data-table tbody td {
  padding: 0.7rem 0.85rem;
  vertical-align: middle;
}

.app-data-table td:first-child,
.app-data-table th:first-child {
  padding-left: 0.9rem;
}

.app-data-table td:last-child,
.app-data-table th:last-child {
  padding-right: 0.9rem;
}

.app-data-table tbody tr {
  border-color: #edf2f7;
}

.app-data-table td .badge {
  font-size: 0.75rem;
  font-weight: 600;
}

.app-data-table .btn,
.app-data-table .btn-group-sm > .btn {
  --bs-btn-padding-y: 0.22rem;
  --bs-btn-padding-x: 0.55rem;
  font-size: 0.8rem;
}

.card {
  border-radius: 0.9rem;
}

.card-header,
.card-body,
.card-footer {
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

.card-header {
  padding-bottom: 0.8rem;
  padding-top: 0.8rem;
}

.form-control,
.form-select {
  font-size: 0.92rem;
}

.btn {
  font-size: 0.9rem;
}

.action-group {
  gap: 0.35rem !important;
}

.action-group .btn {
  min-width: 2rem;
}

.action-group .dropdown-menu {
  min-width: 10rem;
  z-index: 1080;
}

.task-edit-form {
  align-items: flex-start;
}

.task-edit-form .form-control,
.task-edit-form .form-select {
  min-height: calc(1.5em + 0.55rem + 2px);
  padding-bottom: 0.32rem;
  padding-top: 0.32rem;
}

.task-edit-field,
.task-edit-channel-panel,
.task-account-channel-panel {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.task-edit-field,
.task-edit-channel-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.7rem 0.75rem;
}

.task-edit-flat-row {
  display: grid;
  gap: 0.75rem;
}

.task-edit-flat-form {
  padding-top: 0.1rem;
}

.task-edit-flat-row + .task-edit-flat-row {
  border-top: 1px solid #e8eef5;
  padding-top: 0.85rem;
}

.task-edit-flat-row-top,
.task-edit-flat-row-middle {
  grid-template-columns: minmax(280px, 1.7fr) repeat(3, minmax(132px, 0.85fr));
}

.task-edit-flat-row-bottom {
  align-items: start;
  grid-template-columns: minmax(0, 1.85fr) minmax(220px, 0.72fr);
}

.task-edit-flat-row-footer {
  grid-template-columns: minmax(220px, 1fr);
}

.task-edit-name-field {
  min-width: 0;
}

.task-edit-flat-row-top .task-edit-field,
.task-edit-flat-row-middle .task-edit-field,
.task-edit-flat-row-footer .task-edit-field {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.task-edit-form [name="domain_display"],
.task-edit-form [name="app_display"],
.task-edit-form [name="operator_display"] {
  background: #f8fafc;
  border-color: #dbe3ee;
  color: #475569;
  font-weight: 600;
}

.task-edit-account-field {
  align-self: stretch;
}

.task-edit-form .form-label,
.task-account-channel-header .form-label {
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.32rem;
}

.task-edit-flat-row-top .form-label::after,
.task-edit-flat-row-middle .form-label::after,
.task-edit-flat-row-footer .form-label::after {
  background: #e2e8f0;
  border-radius: 999px;
  content: "";
  display: block;
  height: 1px;
  margin-top: 0.28rem;
  width: 100%;
}

.task-account-channel-header {
  margin-bottom: 0.45rem !important;
}

.task-edit-channel-panel {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.task-account-channel-panel {
  min-height: 100%;
  padding: 0.75rem !important;
}

.task-account-channel-panel [data-empty-selected-channel] {
  padding-bottom: 0.4rem !important;
  padding-top: 0.4rem !important;
}

.task-account-channel-panel [data-selected-channel-row] {
  gap: 0.65rem !important;
  padding-bottom: 0.8rem !important;
  padding-top: 0.8rem !important;
}

.task-account-channel-panel [data-selected-channel-row]:last-child {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.task-account-channel-panel [data-selected-channel-row]:first-child {
  padding-top: 0 !important;
}

.global-loading {
  align-items: center;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 1080;
}

.eip-status-chip {
  align-items: center;
  border-radius: 0.95rem;
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  min-height: 2.4rem;
  padding: 0.65rem 1rem;
  text-align: center;
  white-space: nowrap;
}

.eip-status-creating {
  background: #ede9fe;
  color: #5b21b6;
}

.eip-status-binding {
  background: #dbeafe;
  color: #1d4ed8;
}

.eip-status-bind {
  background: #d1fae5;
  color: #065f46;
}

.eip-status-unbinding {
  background: #fef3c7;
  color: #b45309;
}

.eip-status-unbind {
  background: #dff4ea;
  color: #164e3b;
}

.eip-status-offlining {
  background: #fee2e2;
  color: #b91c1c;
}

.eip-status-bind-eni {
  background: #e0f2fe;
  color: #0f4c81;
}

.eip-status-unknown {
  background: #e5e7eb;
  color: #374151;
}

@media (max-width: 991.98px) {
  .main-content {
    padding: 0.7rem 0.7rem 4.5rem;
  }

  .chat-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-form-actions #modelSelect,
  .chat-form-actions #chatSendBtn {
    width: 100%;
  }

  .list-pager-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .list-pager-summary {
    margin-left: 0;
    white-space: normal;
  }

  .list-page-filters .d-flex.align-items-end.gap-3.flex-nowrap {
    align-items: stretch !important;
    flex-direction: column;
    gap: 0.65rem !important;
    overflow: visible !important;
  }

  .list-page-filters .d-flex.align-items-end.gap-2.flex-shrink-0 {
    align-items: stretch !important;
    flex-direction: column;
    gap: 0.3rem !important;
    width: 100%;
  }

  .list-page-filters [style*="width: 220px"],
  .list-page-filters [style*="width: 160px"] {
    width: 100% !important;
  }

  .list-page-toolbar {
    width: 100%;
  }

  .list-page-toolbar .btn-group,
  .list-page-toolbar .btn,
  .list-page-toolbar .btn-group-sm {
    width: 100%;
  }

  .list-page-toolbar .btn-group > .btn {
    flex: 1 1 auto;
  }

  .app-data-table {
    font-size: 0.88rem;
  }

  .app-data-table thead th,
  .app-data-table tbody td {
    padding: 0.62rem 0.68rem;
  }

  .action-group {
    justify-content: flex-start !important;
  }

  .task-edit-flat-row-top,
  .task-edit-flat-row-middle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-edit-flat-row-bottom,
  .task-edit-flat-row-footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-session-card {
    min-height: auto;
  }

  #chatSessionList {
    max-height: 240px;
  }

  .chat-messages {
    min-height: 280px;
  }
}

@media (max-width: 575.98px) {
  .sidebar-link {
    font-size: 0.9rem;
    padding: 0.62rem 0.8rem;
  }

  .main-content {
    padding: 0.62rem 0.62rem 4.25rem;
  }

  .card-header,
  .card-body,
  .card-footer,
  .list-page-filters {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .app-data-table thead th {
    font-size: 0.72rem;
  }

  .app-data-table tbody td {
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-data-table tbody td:last-child {
    max-width: none;
    white-space: normal;
  }

  .task-edit-field,
  .task-edit-channel-panel,
  .task-account-channel-panel {
    border-radius: 0.8rem;
    padding: 0.72rem !important;
  }

  .task-account-channel-header {
    gap: 0.5rem;
  }

  .task-account-channel-panel [data-selected-channel-row] {
    padding-bottom: 0.7rem !important;
    padding-top: 0.7rem !important;
  }

  .task-edit-flat-row-top,
  .task-edit-flat-row-middle,
  .task-edit-flat-row-bottom,
  .task-edit-flat-row-footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-section > .row {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }

  .chat-messages {
    min-height: 240px;
    padding: 0.75rem;
  }

  .chat-bubble {
    border-radius: 0.9rem;
    margin-bottom: 0.6rem;
    max-width: 100%;
    padding: 0.7rem 0.8rem;
  }

  .chat-form-actions {
    gap: 0.55rem;
  }

  .list-page-header {
    align-items: stretch !important;
  }

  .list-page-title,
  .list-page-toolbar {
    width: 100%;
  }

  .list-page-title .h5 {
    font-size: 0.96rem;
  }

  .list-page-filters {
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
  }

  .list-pager-left {
    width: 100%;
  }

  .list-pager-left .btn-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .list-pager-left .btn-group .btn {
    width: 100%;
  }

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