:root {
  --bg: #f4f1ea;
  --panel: rgba(255, 252, 247, 0.92);
  --panel-strong: #fffdf9;
  --line: #ddcfbf;
  --text: #2b241f;
  --muted: #6a5e53;
  --accent: #b85c38;
  --accent-dark: #944528;
  --success: #2e7d5b;
  --danger: #a33e2f;
  --warning: #956521;
  --shadow: 0 24px 60px rgba(71, 48, 31, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(214, 168, 127, 0.34), transparent 26%),
    radial-gradient(circle at bottom right, rgba(184, 92, 56, 0.18), transparent 20%),
    linear-gradient(135deg, #f3efe8 0%, #f7f4ee 100%);
  color: var(--text);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto 1fr;
}

.shell-header {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 34px 18px 36px;
}

.header-eyebrow {
  margin-bottom: 4px;
}

.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: nowrap;
  width: 100%;
}

.header-title {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  flex: 0 0 auto;
}

.brand-panel {
  padding: 12px 36px 48px;
  border-right: 1px solid rgba(185, 159, 134, 0.25);
  background: linear-gradient(180deg, rgba(255, 250, 243, 0.88) 0%, rgba(246, 239, 230, 0.94) 100%);
}

.shell.app-mode .brand-panel {
  display: none;
}

.shell.app-mode {
  grid-template-columns: 1fr;
}

.eyebrow,
.section-label,
.mini-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mini-label {
  display: block;
  margin-bottom: 6px;
}

.header-title,
.panel-head h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
}

.panel-head h2 {
  font-size: 24px;
}

.intro {
  margin: 18px 0 28px;
  color: var(--muted);
  line-height: 1.7;
}

.panel,
.status-card {
  border: 1px solid rgba(176, 150, 122, 0.28);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.content {
  padding: 0 34px 34px;
}

.app-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.app-nav-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(184, 92, 56, 0.16);
  background: rgba(255, 252, 247, 0.82);
  color: var(--accent-dark);
}

.app-nav-button.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, #cd7a4f 100%);
  color: white;
  border-color: transparent;
}

.app-view {
  display: block;
}

.panel {
  padding: 28px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.toolbar,
.button-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button-group {
  flex-wrap: wrap;
}

.status-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-panel {
  max-width: 760px;
}

.auth-methods {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.header-account {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  align-self: center;
  flex: 0 0 auto;
  margin-left: auto;
}

.account-menu {
  position: relative;
  display: flex;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: #ead8c7;
  color: var(--accent-dark);
  font-size: 14px;
  border: 1px solid rgba(184, 92, 56, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  white-space: nowrap;
}

.account-trigger {
  display: inline-flex;
  gap: 10px;
  min-width: 0;
  max-width: 230px;
  justify-content: space-between;
  width: auto;
  overflow: hidden;
}

.account-caret {
  font-size: 12px;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 160px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(176, 150, 122, 0.28);
  background: rgba(255, 252, 247, 0.98);
  box-shadow: var(--shadow);
  z-index: 10;
}

.account-dropdown-item {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid transparent;
}

.account-dropdown-item:hover {
  background: rgba(184, 92, 56, 0.08);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.inline-input-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(184, 92, 56, 0.85);
  box-shadow: 0 0 0 4px rgba(184, 92, 56, 0.12);
}

button {
  border: none;
  border-radius: 14px;
  min-height: 48px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #cd7a4f 100%);
  color: white;
}

.secondary-button {
  background: #efe2d5;
  color: var(--accent-dark);
}

.ghost-button {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(184, 92, 56, 0.24);
}

.wide,
.full-width {
  grid-column: 1 / -1;
}

.entry-card {
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(184, 92, 56, 0.18);
  background: rgba(255, 249, 242, 0.88);
}

.entry-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.entry-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.entry-inline-tip {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.status-card {
  padding: 18px 20px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(255, 251, 245, 0.98), rgba(247, 241, 232, 0.96));
}

.status-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.status-toggle.is-collapsible {
  cursor: pointer;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-label {
  font-size: 14px;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-connected {
  color: var(--success);
  background: rgba(46, 125, 91, 0.12);
}

.status-not_connected {
  color: var(--danger);
  background: rgba(163, 62, 47, 0.12);
}

.status-unchecked {
  color: var(--warning);
  background: rgba(149, 101, 33, 0.12);
}

.status-message {
  margin: 14px 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.status-chevron {
  color: var(--muted);
  font-size: 14px;
}

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

.status-grid strong {
  display: block;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.status-footer {
  margin-top: 14px;
}

.result-meta {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.quota-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(46, 125, 91, 0.10);
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
}

.quota-trigger {
  border: none;
  cursor: pointer;
}

.quota-trigger:hover {
  transform: translateY(-1px);
}

.result-box {
  margin: 0;
  min-height: 320px;
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffdfa 0%, #fffaf5 100%);
  border: 1px solid rgba(176, 150, 122, 0.25);
  word-break: break-word;
  line-height: 1.75;
  font-size: 15px;
}

.result-rich h3,
.result-rich h4,
.result-rich p,
.result-rich ul {
  margin: 0;
}

.result-rich h3 {
  margin-bottom: 18px;
  font-size: 28px;
  line-height: 1.2;
}

.result-rich h4 {
  margin-top: 22px;
  margin-bottom: 10px;
  font-size: 18px;
}

.result-rich p {
  margin-bottom: 10px;
  color: var(--text);
}

.result-rich ul {
  margin: 0 0 8px;
  padding-left: 20px;
}

.result-rich li {
  margin-bottom: 8px;
  color: var(--text);
}

.result-rich code {
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(184, 92, 56, 0.08);
  font-size: 13px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item,
.empty-state {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.88);
  border: 1px solid rgba(176, 150, 122, 0.22);
}

.history-item {
  width: 100%;
  text-align: left;
  background: rgba(255, 253, 250, 0.88);
}

.history-item.active {
  border-color: rgba(184, 92, 56, 0.55);
  box-shadow: inset 0 0 0 1px rgba(184, 92, 56, 0.15);
}

.history-item strong {
  display: block;
  margin-bottom: 6px;
}

.report-item {
  min-height: 0;
}

.hint,
.empty-state {
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 16px;
  color: white;
  background: rgba(46, 125, 91, 0.92);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .shell-header {
    gap: 10px;
    padding: 18px 18px 8px;
  }

  .header-main-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .header-title {
    font-size: 26px;
    flex: 0 1 auto;
  }

  .header-account {
    width: auto;
    min-width: 0;
    justify-content: flex-end;
    margin-left: auto;
  }

  .account-trigger {
    max-width: 190px;
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .brand-panel {
    border-right: none;
    border-bottom: 1px solid rgba(185, 159, 134, 0.25);
    padding: 0 18px 18px;
  }

  .content {
    padding: 0 18px 18px;
  }

  .panel {
    padding: 20px;
  }

  .two-column,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .inline-input-group {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .toolbar,
  .header-account {
    justify-content: space-between;
  }
}
