@import url('./fugle.css');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #F4AF1C;
  --primary-light: #FEF3D0;
  --primary-dark: #D4920A;
  --bg-page: #F5F5F5;
  --bg-card: #FFFFFF;
  --text-primary: #323232;
  --text-secondary: #8b8a8a;
  --text-tertiary: #9CA3AF;
  --border: #eaeaea;
  --border-subtle: #f5f5f5;
  --success: #16A34A;
  --success-bg: #DCFCE7;
  --error: #DC2626;
  --error-bg: #FEE2E2;
  --nav-height: 72px;
  --sidebar-width: 240px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.05);
  --color-component-input-foreground-value: var(--color-neutral-80);
  --color-component-input-foreground-placeholder: #b3b2b2;
  --color-component-input-foreground-required: #d12a2a;
  --color-component-input-stroke-error: #d12a2a;
  --color-component-input-foreground-error: #d12a2a;
  --color-component-segment-bg: var(--color-neutral-08);
  --color-component-segment-selected: var(--color-neutral-00-white);
}

body {
  font-family: 'Lato', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  padding-top: var(--nav-height);
}

/* ─── Navbar ─── */
.navbar {
  height: var(--nav-height);
  background: var(--color-component-nav-logobar);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1200px;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 0;
}

.navbar-root--full .nav-inner {
  max-width: none;
  padding: 0 16px;
}

.navbar-root--full .nav-hamburger {
  padding-left: 0;
}

.nav-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-foreground-primary-default);
  flex-shrink: 0;
}

.nav-hamburger .material-icons-round {
  font-size: 24px;
  line-height: 1;
}

.navbar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  padding-right: 16px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 12px;
  color: var(--color-foreground-primary-default);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-foreground-primary-hover);
}

.nav-link.active {
  color: var(--color-foreground-highlight-normal-default);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 16px;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

.navbar-right-actions {
  display: flex;
  align-items: center;
  align-self: stretch;
}

.nav-login-btn {
  height: 40px;
  width: 72px;
  padding: 0;
  background: var(--color-bg-highlight-primary-normal-default);
  color: var(--color-foreground-inverted-primary-default);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.nav-login-btn:hover {
  background: var(--color-bg-highlight-primary-normal-hover);
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--color-bg-surface-container-default);
  border: 1px solid var(--color-stroke-default);
  border-radius: var(--radius-full);
  flex: 1;
  max-width: 200px;
  overflow: hidden;
}

.search-bar span {
  font-size: 24px;
  color: var(--color-foreground-secondary-default);
  padding: 8px 0 8px 12px;
  flex-shrink: 0;
}

.search-bar input {
  border: none;
  background: transparent;
  color: var(--color-foreground-primary-default);
  outline: none;
  flex: 1;
  min-width: 0;
  padding: 8px 12px 8px 4px;
}

.search-bar input::placeholder {
  color: var(--color-foreground-secondary-default);
}

.nav-mysub-link {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  padding: 0 12px;
  color: var(--color-foreground-primary-default);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
  cursor: pointer;
}

.nav-mysub-link:hover {
  color: var(--color-foreground-primary-hover);
}

.nav-user-wrap {
  position: relative;
}

.nav-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  padding: 4px;
  cursor: pointer;
  background: var(--color-bg-surface-container-default);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  border: 1px solid var(--color-stroke-subtle);
}

.nav-dropdown {
  display: none;
  flex-direction: column;
  gap: 8px;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: var(--color-bg-surface-container-default);
  border: 1px solid var(--color-stroke-default);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 16px -4px var(--color-component-web-frame-shadow-default), 0 4px 8px -4px var(--color-component-web-frame-shadow-default);
  padding: 12px;
  z-index: 200;
}

.nav-dropdown.open {
  display: flex;
}

.dropdown-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.dropdown-user img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-stroke-subtle);
  object-fit: cover;
  flex-shrink: 0;
}

.dropdown-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.dropdown-user-name {
  color: var(--color-foreground-primary-default);
}

.dropdown-user-email {
  color: var(--color-foreground-secondary-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  height: 1px;
  background: var(--color-stroke-default);
}

.dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: var(--color-foreground-primary-default);
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--color-bg-surface-container-hover);
}

.dropdown-item svg {
  flex-shrink: 0;
  color: var(--color-foreground-secondary-default);
}

.dropdown-logout svg {
  flex-shrink: 0;
  color: var(--color-foreground-secondary-default);
}

.dropdown-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--color-foreground-primary-default);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.dropdown-logout:hover {
  background: var(--color-bg-surface-container-hover);
}

/* ─── Layout ─── */
.page-layout {
  display: flex;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-surface-container-default);
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  scrollbar-width: thin;
}

.sidebar:hover::-webkit-scrollbar-thumb { background: var(--color-foreground-tertiary-default); }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: var(--radius-full); transition: background 0.15s; }

.sidebar-user {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  flex-shrink: 0;
  transition: padding 0.3s ease, gap 0.3s ease;
}

.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-stroke-subtle);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-user-text-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  max-width: 200px;
  max-height: 120px;
  transition: opacity 0.2s ease, max-width 0.3s ease, max-height 0.3s ease;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sidebar-user-name {
  color: var(--color-foreground-primary-default);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.sidebar-user-email {
  color: var(--color-foreground-secondary-default);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.coin-tag {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-surface-subtle-default);
  border: 1px solid var(--color-stroke-default);
  border-radius: var(--radius-full);
  padding: 0 12px;
  height: 28px;
  color: var(--color-foreground-secondary-default);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-divider {
  height: 1px;
  background: var(--color-stroke-default);
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  flex: 1;
  transition: padding 0.3s ease;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  color: var(--color-foreground-primary-default);
  cursor: pointer;
  transition: background 0.15s, gap 0.3s ease, padding 0.3s ease;
  user-select: none;
}

.sidebar-item svg {
  flex-shrink: 0;
  color: var(--color-foreground-secondary-default);
}

.sidebar-item:hover {
  background: var(--color-bg-surface-container-hover);
}

.sidebar-item.active {
  background: var(--color-bg-highlight-primary-light-default);
  color: var(--color-foreground-highlight-dark-default);
}

.sidebar-item.active svg {
  color: inherit;
}

.sidebar-label {
  overflow: hidden;
  white-space: nowrap;
  max-width: 160px;
  transition: opacity 0.15s ease, max-width 0.3s ease;
}

.sidebar-tooltip {
  display: none;
}

.sidebar-collapse-btn {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  margin-top: auto;
  color: var(--color-foreground-secondary-default);
  flex-shrink: 0;
}

.sidebar-collapse-btn svg {
  flex-shrink: 0;
  color: var(--color-foreground-secondary-default);
}

/* Collapsed state (JS-triggered, mirrors MD layout) */
.sidebar.collapsed {
  width: 64px;
  overflow: visible;
}

.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: 8px;
  gap: 0;
  cursor: pointer;
  position: relative;
}

.sidebar.collapsed .sidebar-avatar-wrap {
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.sidebar.collapsed .sidebar-user:hover .sidebar-avatar-wrap {
  background: var(--color-bg-surface-container-hover);
}

.sidebar.collapsed .sidebar-user-text-group {
  opacity: 0;
  max-width: 0;
  max-height: 0;
  pointer-events: none;
}

.sidebar.collapsed .sidebar-nav {
  padding: 12px 8px;
}

.sidebar.collapsed .sidebar-label {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

.sidebar.collapsed .sidebar-item {
  position: relative;
  justify-content: center;
  gap: 0;
  padding: 8px;
}

.sidebar.collapsed .sidebar-collapse-btn,
.sidebar.collapsed .sidebar-collapse-btn svg {
  color: var(--color-foreground-secondary-default);
}

.sidebar.collapsed .sidebar-tooltip {
  display: block;
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #323232;
  color: #ffffff;
  font-size: 14px;
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 400;
  filter: drop-shadow(0px 0px 1.5px rgba(0, 0, 0, 0.15));
}

.sidebar.collapsed .sidebar-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6.93px 9px 6.93px 0;
  border-style: solid;
  border-color: transparent #323232 transparent transparent;
}

.sidebar.collapsed .sidebar-item:hover .sidebar-tooltip,
.sidebar.collapsed .sidebar-user:hover .sidebar-tooltip {
  opacity: 1;
}

.sidebar.sidebar-no-tooltip .sidebar-item .sidebar-tooltip,
.sidebar.sidebar-no-tooltip .sidebar-user .sidebar-tooltip {
  opacity: 0 !important;
  transition: none !important;
}

.modal-box.sidebar-user-modal-box {
  width: 320px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--color-bg-surface-container-default);
  box-shadow: 0 2px 16px 4px rgba(0, 0, 0, 0.08), 0 4px 8px 4px rgba(0, 0, 0, 0.08);
}

.sidebar-user-dialog-title {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 0 12px 0 24px;
  border-bottom: 1px solid var(--color-stroke-subtle);
  flex-shrink: 0;
}

.sidebar-user-dialog-title > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-foreground-primary-default);
}

.sidebar-user-modal-close {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--color-foreground-secondary-default);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  padding: 0;
}

.sidebar-user-modal-close:hover {
  background: var(--color-bg-surface-subtle-default);
  color: var(--color-foreground-primary-default);
}

.sidebar-user-dialog-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.sidebar-user-modal-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-stroke-subtle);
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-user-popup-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.sidebar-user-popup-name-email {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: center;
}

.sidebar-user-popup-info .coin-tag {
  align-self: center;
}

.sidebar-user-popup-name {
  color: var(--color-foreground-primary-default);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.sidebar-user-popup-email {
  color: var(--color-foreground-secondary-default);
  width: 100%;
}

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 60px;
  scrollbar-width: thin;
}

.main-content:hover::-webkit-scrollbar-thumb { background: var(--color-foreground-tertiary-default); }
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-thumb { background: transparent; border-radius: var(--radius-full); transition: background 0.15s; }

.content-wrap {
  padding: 32px 32px 0;
}

.content-narrow {
  max-width: 800px;
}

.page-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.page-title::before {
  display: none;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title-row .page-title {
  margin-bottom: 0;
}

.dev-toggle-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.empty-state-dev-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  color: var(--color-foreground-secondary-default);
}

.empty-state-dev-toggle input[type="checkbox"] {
  display: none;
}

.empty-state-dev-toggle input:checked + .toggle-track {
  background: var(--color-bg-highlight-primary-normal-default);
}

.empty-state-dev-toggle input:checked + .toggle-track .toggle-thumb {
  left: 16px;
}

.plan-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-top: 60px;
  width: 100%;
}

.plan-empty-state-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: var(--color-foreground-secondary-default);
  width: 100%;
}

/* ─── Tabs ─── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-stroke-heavy);
  margin-bottom: 16px;
}

.tab-btn {
  padding: 0 12px;
  height: 41px;
  color: var(--color-foreground-secondary-default);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover {
  color: var(--color-foreground-primary-default);
}

.tab-btn.active {
  color: var(--color-foreground-primary-default);
  border-bottom-color: var(--color-bg-highlight-primary-normal-default);
}

/* ─── Filter Tags ─── */
.orders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.orders-toolbar .filter-bar {
  margin-bottom: 0;
}

.filter-bar {
  display: flex;
  gap: 4px;
  padding-left: 8px;
  margin-bottom: 24px;
}

.filter-tag {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: none;
  color: var(--color-foreground-primary-default);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tag:hover {
  color: var(--color-foreground-primary-hover);
}

.filter-tag.active {
  background: var(--color-bg-highlight-primary-normal-default);
  color: var(--color-foreground-inverted-primary-default);
}

/* ─── Order Source Dropdown ─── */
.order-source-dropdown {
  position: relative;
}

.order-source-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 12px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-stroke-default);
  background: var(--color-bg-surface-container-default);
  color: var(--color-foreground-primary-default);
  cursor: pointer;
  white-space: nowrap;
}

.order-source-trigger:hover {
  color: var(--color-foreground-primary-hover);
}

.order-source-trigger-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.order-source-chevron {
  font-size: 20px;
  color: var(--color-foreground-secondary-default);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.order-source-dropdown.open .order-source-chevron {
  transform: rotate(-180deg);
}

.order-source-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: -8px;
  background: var(--color-bg-surface-container-default);
  border-radius: var(--radius-sm);
  box-shadow: 0px 2px 16px 4px var(--color-component-web-frame-shadow-default);
  z-index: 100;
  min-width: 160px;
  padding: 8px 0;
  overflow: hidden;
}

.order-source-dropdown.open .order-source-menu {
  display: block;
}

.order-source-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--color-foreground-primary-default);
  white-space: nowrap;
  transition: background 0.1s;
}

.order-source-option:hover {
  background: var(--color-bg-surface-container-hover);
}

.order-source-option.selected {
  background: var(--color-bg-highlight-primary-light-default);
}


.order-source-option-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}

/* ─── Plan Cards ─── */
.plan-list {
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plan-list.plan-list--empty {
  max-width: none;
}

.plan-section-divider {
  height: 1px;
  background: var(--color-stroke-heavy);
  margin: 16px 0;
}

.plan-card {
  background: var(--color-bg-surface-container-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.plan-card--expandable {
  align-items: flex-start;
}

.plan-card.ended .plan-card-main,
.plan-card.ended .plan-card-middle {
  opacity: 0.70;
}

.plan-card--external .plan-card-main,
.plan-card--external .plan-card-right {
  margin-top: 0;
}

.plan-card-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 0 0 220px;
  margin-top: 4px;
}

.plan-card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-name-info-icon {
  flex-shrink: 0;
  color: var(--color-foreground-secondary-default);
  transition: color 0.15s;
}

.plan-name {
  transition: color 0.15s;
}

.plan-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #f5f5f5;
  object-fit: cover;
  flex-shrink: 0;
}

.plan-card-middle {
  flex: 1;
  min-width: 0;
}

.info-callout {
  background: var(--color-bg-surface-subtle-default);
  border-radius: var(--radius-xs);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.info-callout.open {
  cursor: default;
}

.info-callout--cancelled {
  background: var(--color-bg-highlight-primary-light-default);
  cursor: default;
}

.info-callout-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  align-self: stretch;
}

.info-callout-chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
}

.info-callout.open .info-callout-chevron {
  transform: rotate(-180deg);
}

.info-extra {
  display: none;
  flex-direction: column;
  gap: 4px;
}

.info-callout.open .info-extra {
  display: flex;
}

.plan-name {
  color: var(--color-foreground-primary-default);
}

.plan-info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-info-item {
  display: flex;
  align-items: center;
  color: var(--color-foreground-primary-default);
}

.plan-external-hint {
  display: block;
  background: var(--color-bg-surface-subtle-default);
  padding: 12px;
  border-radius: var(--radius-xs);
  color: var(--color-foreground-secondary-default);
}

.plan-info-divider {
  width: 1px;
  height: 12px;
  background: var(--border);
  flex-shrink: 0;
}

.badge-renew {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-renew.on {
  background: var(--success-bg);
  color: var(--success);
}

.badge-renew.off {
  background: var(--border-subtle);
  color: var(--text-tertiary);
}

.badge-renew .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-renew.on .dot {
  background: var(--success);
}

.badge-renew.off .dot {
  background: var(--text-tertiary);
}

.badge-ended {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: var(--border-subtle);
  color: var(--text-tertiary);
}

.plan-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.plan-card--expandable .plan-card-right {
  margin-top: 12px;
}

.plan-card--settings {
  flex-direction: column;
  align-items: stretch;
}

.plan-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.plan-card-footer {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ─── Shimmer ─── */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.shimmer-bar,
.shimmer-block {
  background: linear-gradient(90deg, #eaeaea 25%, #f5f5f5 50%, #eaeaea 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 4px;
}

.plan-card-shimmer {
  background: var(--color-bg-surface-container-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.plan-card-shimmer-main {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shimmer-bar--name {
  height: 28px;
}

.shimmer-bar--price {
  height: 24px;
  width: 100px;
}

.plan-card-shimmer-middle {
  flex: 1;
  height: 70px;
  min-width: 0;
}

.plan-card-shimmer-right {
  flex-shrink: 0;
  height: 40px;
  width: 96px;
}

/* ─── Order Table Shimmer ─── */
.order-shimmer-id     { height: 16px; width: 134px; }
.order-shimmer-name   { height: 16px; width: 200px; }
.order-shimmer-date   { height: 16px; width: 88px; }
.order-shimmer-card   { height: 16px; width: 88px; }
.order-shimmer-amount { height: 16px; width: 40px; }
.order-shimmer-discount { height: 16px; width: 40px; }
.order-shimmer-invoice  { height: 16px; width: 64px; }
.order-shimmer-status   { height: 16px; width: 64px; }
.order-shimmer-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

.btn-text-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.plan-info-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin-left: 8px;
  flex-shrink: 0;
}

.plan-info-toggle input[type="checkbox"] {
  display: none;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-row input[type="checkbox"] {
  display: none;
}

.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--border);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-row input:checked + .toggle-track {
  background: var(--primary);
}

.plan-info-toggle input:checked + .toggle-track {
  background: var(--color-bg-highlight-primary-normal-default);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-row input:checked + .toggle-track .toggle-thumb {
  left: 14px;
}

.plan-info-toggle .toggle-track {
  width: 29px;
  height: 16px;
  background: var(--color-bg-surface-variant-high-default);
}

.plan-info-toggle .toggle-thumb {
  width: 13px;
  height: 13px;
  top: 1.5px;
  left: 1.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.plan-info-toggle input:checked + .toggle-track .toggle-thumb {
  left: 14.5px;
}

.toggle-label-text {
  font-size: 14px;
  color: var(--text-primary);
}

.toggle-sub-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: auto;
}

.plan-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-left: 32px;
}

.plan-price {
  color: var(--color-foreground-primary-default);
}

.plan-price-unit {
  color: var(--color-foreground-primary-default);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  gap: 4px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-bg-surface-inverse-default);
  color: var(--color-foreground-inverted-primary-default);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--color-bg-surface-inverse-hover);
}

.btn-secondary--icon {
  padding-left: 20px;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  width: 96px;
  border: none;
  background: transparent;
  color: var(--color-foreground-link-underline-default);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-link:hover {
  color: var(--color-foreground-link-underline-hover);
}

.btn-tertiary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-bg-surface-variant-default);
  color: var(--color-foreground-secondary-default);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-tertiary:hover {
  background: var(--color-bg-surface-variant-hover);
}

.btn-tertiary:active {
  background: var(--color-bg-surface-variant-active);
}

.btn-plan-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-stroke-heavy);
  background: var(--color-bg-surface-container-default);
  color: var(--color-foreground-primary-default);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-plan-cancel:hover {
  background: var(--color-bg-surface-variant-default);
}

.btn-cancel {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #dfdfdf;
  background: #ffffff;
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #323232;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-cancel:hover {
  background: #f5f5f5;
}

.btn-renew {
  display: inline-block;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: #000000;
  font-family: 'Lato', sans-serif;
  text-decoration: none;
  font-size: 16px;
  font-weight: 400;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-renew:hover {
  background: #323232;
}

.btn-renew--icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 20px;
  padding-right: 16px;
}

.btn-renew-icon {
  width: 20px;
  height: 20px;
  filter: invert(1);
}


/* ─── Tab Panels ─── */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ─── Link Underline (共用底線連結樣式) ─── */
/* 套用此 class 後自動有 default + hover 兩個狀態的 token */
.fugle-link-underline {
  color: var(--color-foreground-link-underline-default);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.15s;
}

.fugle-link-underline:hover {
  color: var(--color-foreground-link-underline-hover);
}

/* ─── Select Chevron (共用 dropdown 箭頭樣式) ─── */
.fugle-select-chevron {
  color: var(--color-foreground-secondary-default);
  font-size: 20px;
  transition: transform 0.2s;
}

/* ─── Select Menu (共用 dropdown menu 樣式) ─── */
.fugle-select-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--color-bg-surface-container-default);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px 0 var(--color-component-web-frame-shadow-default);
  padding: 8px 0;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.fugle-select-menu:hover {
  scrollbar-color: var(--color-foreground-tertiary-default) transparent;
}

.fugle-select-menu::-webkit-scrollbar {
  width: 6px;
}

.fugle-select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.fugle-select-menu::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--radius-full);
  transition: background 0.15s;
}

.fugle-select-menu:hover::-webkit-scrollbar-thumb {
  background: var(--color-foreground-tertiary-default);
}

/* ─── Fugle Segmented Control（共用，未選 fugle-btn-sm / 選中 fugle-body2-bold） ─── */
.fugle-segmented-control {
  display: flex;
  background: var(--color-component-segment-bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  width: 100%;
  height: 32px;
}

.fugle-segmented-control-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-foreground-secondary-default);
  line-height: 1.5;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  user-select: none;
}

.fugle-segmented-control-tab.active {
  background: var(--color-component-segment-selected);
  color: var(--color-foreground-primary-default);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  /* 選中時切到 Body2 Bold 字重（與未選 Button SM 不同） */
  font-weight: 700;
}

/* ─── Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  width: 480px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.modal-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-modal-keep {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-modal-keep:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-modal-confirm {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--error);
  background: transparent;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--error);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-modal-confirm:hover {
  background: var(--error-bg);
}

.btn-modal-primary {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-modal-primary:hover {
  opacity: 0.85;
}

/* ─── Fugle Coin Dialog ─── */
#fugle-coin-modal .modal-box {
  padding: 0;
  background: var(--color-bg-surface-container-default);
  border-radius: 8px;
  box-shadow: 0 4px 8px 4px var(--color-component-web-frame-shadow-default),
              0 2px 16px 4px var(--color-component-web-frame-shadow-default);
}

#fugle-coin-modal .coin-dialog-title {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-stroke-subtle);
  color: var(--color-foreground-primary-default);
}

#fugle-coin-modal .coin-dialog-body {
  padding: 20px;
  color: var(--color-foreground-primary-default);
}

#fugle-coin-modal .modal-actions {
  border-top: 1px solid var(--color-stroke-subtle);
  padding: 16px 20px;
  gap: 12px;
}

.btn-coin-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-bg-highlight-primary-normal-default);
  color: var(--color-foreground-inverted-primary-default);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-coin-confirm:hover {
  background: var(--color-bg-highlight-primary-normal-hover);
}

.btn-coin-confirm:active {
  background: var(--color-bg-highlight-primary-normal-active);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-bg-status-danger);
  color: var(--color-foreground-inverted-primary-default);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-danger:hover {
  background: var(--color-red-600);
}

.btn-danger:active {
  background: var(--color-red-700);
}

/* ─── Shared Form Input ─── */
.fugle-form-input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--color-stroke-default);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--color-component-input-foreground-value);
  background: var(--color-bg-surface-container-default);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.fugle-form-input::placeholder {
  color: var(--color-component-input-foreground-placeholder);
}

.fugle-form-input:focus {
  border-color: var(--primary);
}

.fugle-form-input:disabled {
  background: var(--color-bg-surface-subtle-default);
  cursor: not-allowed;
  color: var(--color-foreground-secondary-default);
}

.fugle-form-input.error {
  border-color: var(--color-component-input-stroke-error);
}

/* ─── Change Card Dialog ─── */
#change-card-modal .modal-box {
  padding: 0;
  background: var(--color-bg-surface-container-default);
  border-radius: 8px;
  box-shadow: 0 4px 8px 4px var(--color-component-web-frame-shadow-default),
              0 2px 16px 4px var(--color-component-web-frame-shadow-default);
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
}

#change-card-modal .change-dialog-title {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-stroke-subtle);
  color: var(--color-foreground-primary-default);
}

.change-card-demo-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.change-card-demo-toggle input[type="checkbox"] {
  display: none;
}

.change-card-demo-toggle input:checked + .toggle-track {
  background: var(--primary);
}

.change-card-demo-toggle input:checked + .toggle-track .toggle-thumb {
  left: 16px;
}

.change-card-demo-label {
  color: var(--color-foreground-secondary-default);
}

#change-card-modal .modal-form {
  padding: 20px;
  margin-bottom: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
}

.change-form-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#change-card-modal .form-group {
  gap: 4px;
}

#change-card-modal .form-row {
  gap: 16px;
}

.change-form-label {
  color: var(--color-foreground-primary-default);
}

.form-required {
  color: var(--color-component-input-foreground-required);
}

.form-input-wrap {
  position: relative;
}

.form-input-wrap .fugle-form-input {
  padding-right: 96px;
}

.form-input-wrap .card-brand-icons {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.change-dialog-caption {
  color: var(--color-foreground-secondary-default);
}

#change-card-modal .modal-actions {
  border-top: 1px solid var(--color-stroke-subtle);
  padding: 16px 20px;
  gap: 12px;
}

.change-form-divider {
  height: 1px;
  background: var(--color-stroke-default);
  border: none;
  flex-shrink: 0;
  margin: 24px 0;
}

.change-form-bottom {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.change-form-error {
  display: none;
  color: var(--color-component-input-foreground-error);
}

.change-form-error.visible {
  display: block;
}

.change-phone-wrap {
  display: flex;
  gap: 8px;
}

.change-phone-input-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.cc-phone-select-wrap {
  position: relative;
  width: 150px;
  flex-shrink: 0;
}

.cc-phone-select-input {
  padding-right: 40px;
  cursor: text;
}

.cc-phone-select-chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.cc-phone-select-wrap.open .cc-phone-select-chevron {
  transform: translateY(-50%) rotate(-180deg);
}

.cc-phone-select-wrap.open .cc-phone-select-menu {
  display: block;
}

.cc-phone-select-menu {
  max-height: 300px;
}

.cc-phone-select-wrap.open-up .cc-phone-select-menu {
  top: auto;
  bottom: calc(100% + 8px);
}

.cc-phone-select-item {
  padding: 8px 16px;
  color: var(--color-component-input-foreground-value);
  cursor: pointer;
  background: var(--color-bg-surface-container-default);
  white-space: nowrap;
}

.cc-phone-select-item:hover,
.cc-phone-select-item.focused {
  background: var(--color-bg-surface-container-hover);
}

.cc-phone-select-item.active {
  background: var(--color-bg-highlight-primary-light-default);
}

.cc-phone-select-no-result {
  padding: 10px 16px;
  color: var(--color-foreground-secondary-default);
}

/* ─── Cancel Dialog ─── */
#cancel-modal .modal-box {
  padding: 0;
  background: var(--color-bg-surface-container-default);
  border-radius: 8px;
  box-shadow: 0 4px 8px 4px var(--color-component-web-frame-shadow-default),
              0 2px 16px 4px var(--color-component-web-frame-shadow-default);
}
#cancel-modal .cancel-dialog-title {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-stroke-subtle);
  color: var(--color-foreground-primary-default);
}
#cancel-modal .cancel-dialog-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cancel-info-block {
  background: var(--color-bg-surface-subtle-default);
  border-radius: var(--radius-xs);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--color-foreground-primary-default);
}
.cancel-info-row {
  display: flex;
  align-items: center;
}
.cancel-info-label {
  white-space: nowrap;
}
.cancel-info-value {
  flex: 1;
  min-width: 0;
}
.cancel-notice {
  display: flex;
  gap: 2px;
  align-items: flex-start;
}
.cancel-notice-icon {
  padding-top: 2px;
  flex-shrink: 0;
}
.cancel-notice-text {
  color: var(--color-foreground-secondary-default);
  flex: 1;
}
#cancel-modal .modal-actions {
  border-top: 1px solid var(--color-stroke-subtle);
  padding: 16px 20px;
  gap: 12px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--primary);
}

.form-input::placeholder {
  color: var(--border);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-brand-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-brand-icon {
  height: 20px;
  filter: grayscale(100%) opacity(0.4);
  transition: filter 0.2s;
}

.card-brand-icon.active {
  filter: none;
}

.card-brand-icon-inline {
  height: 24px;
  display: inline-block;
  vertical-align: middle;
}

.plan-card-number {
  display: flex;
  align-items: center;
  gap: 4px;
}

.plan-card-number-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-callout {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.modal-cancel-detail-block {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-cancel-detail-item {
  display: flex;
  gap: 4px;
  font-size: 14px;
  line-height: 1.5;
}

.modal-cancel-detail-label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.modal-cancel-detail-value {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-cancel-notice {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  align-items: flex-start;
}

.modal-cancel-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.modal-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ─── Order Table ─── */
.order-table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05);
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.order-table-wrap:hover,
.order-table-wrap:has(td:hover) {
  scrollbar-color: var(--color-foreground-tertiary-default) transparent;
}

.order-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.order-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.order-table-wrap::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--radius-full);
  transition: background 0.15s;
}

.order-table-wrap:hover::-webkit-scrollbar-thumb,
.order-table-wrap:has(td:hover)::-webkit-scrollbar-thumb {
  background: var(--color-foreground-tertiary-default);
}

.order-scroll-wrap {
  position: relative;
}

.order-scroll-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 100%;
  background: linear-gradient(to right, transparent, var(--color-bg-surface-container-default));
  pointer-events: none;
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  transition: opacity 0.15s;
}

.order-scroll-wrap.no-overflow::after,
.order-scroll-wrap.scroll-end::after {
  opacity: 0;
}

.order-scroll-wrap.sticky-active::after {
  position: fixed;
  top: var(--sticky-grad-top, 0);
  right: var(--sticky-grad-right, 0);
  height: var(--sticky-grad-height, 100%);
}

.order-table {
  min-width: 100%;
  border-collapse: collapse;
}

.order-table thead th {
  padding: 12px 16px;
  color: var(--color-foreground-secondary-default);
  text-align: left;
  border-bottom: 1px solid var(--color-stroke-heavy);
  background: var(--color-bg-surface-subtle-default);
  white-space: nowrap;
  width: 1%;
}

.order-table th.col-hug,
.order-table td.col-hug {
  white-space: nowrap;
}

.order-table tbody tr.order-row {
  border-bottom: 1px solid var(--color-stroke-subtle);
  background: var(--color-bg-surface-container-default);
  cursor: default;
  transition: background 0.1s;
}

.order-table tbody tr.order-row:hover {
  background: var(--color-bg-surface-container-hover);
}

.order-table tbody td {
  padding: 16px;
  color: var(--color-foreground-primary-default);
  vertical-align: middle;
  white-space: nowrap;
  max-width: 360px;
}

.order-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-name-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  object-fit: cover;
}

.order-name {
  color: var(--text-primary);
}

.order-id-text {
  color: var(--text-tertiary);
}

.order-card-text {
  color: var(--text-secondary);
  white-space: nowrap;
}

.order-card-text .card-brand-icon-inline {
  margin-right: 4px;
}

.order-amount {
  white-space: nowrap;
}

.btn-invoice {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-foreground-link-underline-default);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}

.btn-invoice:hover {
  color: var(--color-foreground-link-underline-hover);
}

.status-badge {
  white-space: nowrap;
}

.status-badge.success {
  color: var(--color-foreground-status-success-default);
}

.status-badge.failed {
  color: var(--color-foreground-status-error-default);
}

.status-badge.pending {
  color: var(--color-foreground-status-warning-default);
}

.order-table tbody td.order-reason-text {
  color: var(--color-foreground-primary-default);
  min-width: 360px;
  white-space: normal;
  word-break: break-word;
}

.order-reason-link {
  color: var(--color-foreground-link-underline-default);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.order-reason-link:hover {
  color: var(--color-foreground-link-underline-hover);
}

/* Pagination */
.pagination-bar {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 8px;
  border-radius: var(--radius-xs);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-foreground-primary-default);
  transition: background 0.15s;
}

.pagination-item:hover:not(:disabled) {
  background: var(--color-bg-surface-container-hover);
}

.pagination-item.active {
  background: var(--color-bg-surface-variant-high-default);
  color: var(--color-foreground-primary-default);
}

.pagination-item:disabled {
  opacity: 0.35;
  cursor: default;
}

.pagination-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--color-foreground-secondary-default);
  user-select: none;
}

.expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.expand-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-page);
}

.expand-btn .material-icons-round {
  font-size: 20px;
  transition: transform 0.2s;
}

.expand-btn.open .material-icons-round {
  transform: rotate(-180deg);
}

.expand-row {
  display: none;
}

.expand-row.open {
  display: table-row;
}

.expand-row td {
  padding: 0 16px 14px;
}

.expand-content {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.expand-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.expand-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.expand-value {
  font-size: 13px;
  color: var(--text-primary);
}

/* ─── Breakpoints ─── */
/* LG: ≥1024px — default styles above */

@media (max-width: 1023px) {
  /* MD: 640px – 1023px */
  .nav-inner {
    gap: 0;
  }

  .nav-hamburger {
    display: flex;
  }

  .navbar-logo {
    padding-right: 0;
  }

  .navbar-nav {
    display: none;
  }

  .content-wrap {
    padding: 24px 16px 0;
  }

  .sidebar {
    width: 64px;
    overflow: visible;
  }

  .sidebar-user {
    justify-content: center;
    padding: 8px;
    cursor: pointer;
    position: relative;
  }

  .sidebar-avatar-wrap {
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
  }

  .sidebar-user:hover .sidebar-avatar-wrap {
    background: var(--color-bg-surface-container-hover);
  }

  .sidebar-user-text-group {
    display: none;
  }

  .sidebar-nav {
    padding: 12px 8px;
  }

  .sidebar-label {
    display: none;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar-item {
    position: relative;
    justify-content: center;
    padding: 8px;
  }

  .sidebar-tooltip {
    display: block;
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #323232;
    color: #ffffff;
    font-size: 14px;
    white-space: nowrap;
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 400;
    filter: drop-shadow(0px 0px 1.5px rgba(0, 0, 0, 0.15));
  }

  .sidebar-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6.93px 9px 6.93px 0;
    border-style: solid;
    border-color: transparent #323232 transparent transparent;
  }

  .sidebar-item:hover .sidebar-tooltip,
  .sidebar-user:hover .sidebar-tooltip {
    opacity: 1;
  }

  /* Plan card shimmer MD layout */
  .plan-card-shimmer {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .plan-card-shimmer-main {
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .shimmer-bar--name {
    flex: 0 0 160px;
    height: 28px;
  }

  .shimmer-bar--price {
    width: 100px;
    height: 24px;
  }

  .plan-card-shimmer-middle {
    order: 3;
    flex: 0 0 100%;
    height: 70px;
  }

  .plan-card-shimmer-right {
    order: 2;
    flex-shrink: 0;
  }

  /* Plan card MD layout */
  .plan-card {
    flex-wrap: wrap;
    column-gap: 16px;
    row-gap: 12px;
    align-items: center;
  }

  .plan-card--expandable {
    align-items: center;
  }

  .plan-card-main {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    column-gap: 0;
    row-gap: 4px;
    max-width: none;
    margin-top: 0;
  }

  .plan-card-name-row {
    min-width: 0;
  }

  .plan-price-wrap {
    margin-left: 0;
  }

  .plan-card-middle {
    order: 3;
    flex: 0 0 100%;
  }

  .plan-card-right {
    order: 2;
    margin-top: 0;
  }

  .plan-card--expandable .plan-card-right {
    margin-top: 0;
  }

}

@media (max-width: 639px) {
  /* SM: <640px */
  :root {
    --nav-height: 64px;
  }

  /* Plan card shimmer SM layout */
  .plan-card-shimmer-main {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 0;
    align-items: center;
  }

  .shimmer-bar--name {
    flex: 0 0 160px;
    height: 28px;
  }

  .shimmer-bar--price {
    flex: 0 0 100px;
    height: 24px;
  }

  /* Plan card main SM layout */
  .plan-card-main {
    justify-content: space-between;
  }

  .content-wrap {
    padding: 24px 16px 0;
  }

  /* Navbar SM layout */
  .nav-inner {
    padding-right: 16px;
  }

  .navbar-logo svg {
    height: 20px;
    width: auto;
  }

  .navbar--logged-in .navbar-logo {
    display: none;
  }

  .search-bar {
    flex: 1 1 1px;
    min-width: 0;
    max-width: 200px;
  }

  .sidebar {
    display: none;
  }

  /* orders-toolbar SM：左側 tag 保持完整寬度，右側 filter 可縮並省略文字 */
  .orders-toolbar .filter-bar {
    flex-shrink: 0;
  }

  #order-source-root,
  .order-source-dropdown,
  .order-source-trigger {
    min-width: 0;
  }

  .order-source-trigger {
    max-width: 100%;
  }

  .order-source-label {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .modal-box {
    width: calc(100% - 32px);
    max-width: 360px;
  }

  #cancel-modal .modal-actions > *,
  #change-card-modal .modal-actions > *,
  #fugle-coin-modal .modal-actions > * {
    flex: 1;
  }
}

/* ─── Site Footer ─── */
.site-footer {
  width: 100%;
  background: #131313;
  color: #ffffff;
}

.site-footer-inner {
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-footer-top {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.site-footer-logos {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-footer-tagline {
  font-size: 20px;
  font-weight: 700;
}

.site-footer-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-footer-cols {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  margin-bottom: 24px;
  box-sizing: border-box;
}

.site-footer-col {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer-col-title {
  font-size: 14px;
  color: #cccccc;
  margin: 0 0 12px;
}

.site-footer-col li {
  padding: 2px 0;
}

.site-footer-col li a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.1s ease-out;
}

.site-footer-col li a:hover {
  color: #F4AF1C;
}

.site-footer-app {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.site-footer-app-label {
  font-size: 14px;
  color: #cccccc;
}

.site-footer-app-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.site-footer-app-badges {
  display: flex;
  gap: 8px;
}

.site-footer-app-badges a {
  display: block;
}

.site-footer-app-qr {
  display: none;
  width: 92px;
  height: 92px;
}

.site-footer-divider {
  width: 100%;
  margin: 40px 0;
  border: none;
  border-top: 1px solid #656565;
}

.site-footer-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.site-footer-socials {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-footer-social {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #DFDFDF;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease-out;
}

.site-footer-social:hover {
  background: #F5F5F5;
}

/* MD: 內容區改成 row、3 cols 並排但有 gap、badges 改 column */
@media (min-width: 640px) {
  .site-footer-top {
    max-width: 800px;
  }

  .site-footer-divider {
    max-width: 800px;
  }

  .site-footer-bottom {
    max-width: 800px;
  }

  .site-footer-content {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 60px;
  }

  .site-footer-cols {
    width: auto;
    gap: 60px;
    padding: 0;
    margin-bottom: 0;
    justify-content: flex-start;
  }

  .site-footer-app-badges {
    flex-direction: column;
  }
}

/* LG: brand + cols + app 全在同一 row、QR 出現 */
@media (min-width: 1024px) {
  .site-footer-top {
    max-width: 1200px;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 60px;
  }

  .site-footer-divider {
    max-width: 1200px;
  }

  .site-footer-bottom {
    max-width: 1200px;
    flex-direction: row;
    justify-content: center;
  }

  .site-footer-brand {
    margin-bottom: 0;
  }

  .site-footer-app-qr {
    display: block;
  }
}
