:root {
  --line: rgba(49, 70, 56, 0.14);
  --ink: #273429;
  --muted: #73806f;
  --accent: #2f6d4f;
  --accent-strong: #244f3a;
  --accent-soft: #e8f0df;
  --danger: #a7493f;
  --panel: rgba(255, 251, 243, 0.9);
  --card: rgba(255, 255, 255, 0.76);
  --card-strong: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 52px rgba(62, 48, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Palatino Linotype", "Songti SC", "Noto Serif CJK SC", serif;
  background:
    radial-gradient(circle at top left, rgba(243, 231, 203, 0.78), transparent 22rem),
    radial-gradient(circle at bottom right, rgba(232, 240, 223, 0.86), transparent 24rem),
    linear-gradient(180deg, #f8f4ec 0%, #f1f5ec 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.18rem;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  box-shadow: 0 8px 20px rgba(47, 109, 79, 0.18);
}

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

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

button.secondary {
  color: var(--ink);
  background: #f7edd5;
  box-shadow: none;
}

button.ghost,
button.action-ghost {
  color: var(--accent-strong);
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
}

button.danger-text {
  color: var(--danger);
  border-color: rgba(167, 73, 63, 0.2);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.88rem 0.96rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(47, 109, 79, 0.35);
  box-shadow: 0 0 0 4px rgba(47, 109, 79, 0.09);
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

.brand-mark {
  margin: 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-block {
  display: flex;
  justify-content: center;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(460px, 100%);
  display: grid;
  gap: 20px;
}

.auth-card,
.section-head,
.modal-card,
.shell-topbar {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  border-radius: 32px;
  padding: 28px 24px;
  display: grid;
  gap: 18px;
}

.auth-brand-block {
  justify-content: center;
}

.auth-panel-card {
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.95), rgba(242, 247, 236, 0.9));
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(247, 241, 226, 0.9);
}

.auth-tab {
  padding: 0.86rem 1rem;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.auth-tab.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(47, 109, 79, 0.18);
}

.auth-card-head {
  display: grid;
  gap: 8px;
}

.auth-card-head h2 {
  margin: 0;
  font-size: 1.55rem;
}

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

.auth-panel,
.form-grid {
  display: grid;
  gap: 14px;
}

.account-mode-panel {
  margin-bottom: 10px;
}

.modal-tip {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 251, 243, 0.88);
  border: 1px solid rgba(49, 70, 56, 0.08);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-link-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

.auth-text-link {
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}

.auth-text-link:hover {
  transform: none;
}

.dashboard {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 100px;
  display: grid;
  gap: 18px;
}

.shell-topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  border-radius: 26px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-context {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(40vw, 320px);
  padding: 0 12px;
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.menu-toggle {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 18px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
}

.admin-shell {
  display: grid;
  gap: 16px;
}

.admin-hero,
.admin-block,
.admin-summary-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.admin-hero,
.admin-block {
  border-radius: 28px;
  padding: 18px 20px;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.admin-hero-copy {
  display: grid;
  gap: 6px;
}

.admin-hero-copy h3,
.admin-block-head h4,
.security-panels h5 {
  margin: 0;
}

.admin-eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-hero-copy p,
.admin-block-head p {
  margin: 0;
  color: var(--muted);
}

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

.admin-summary-card {
  border-radius: 24px;
  padding: 16px 18px;
  display: grid;
  gap: 8px;
}

.admin-summary-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-summary-card strong {
  font-size: 1.45rem;
}

.admin-summary-card.leaf {
  background: linear-gradient(180deg, rgba(233, 242, 229, 0.96), rgba(255, 255, 255, 0.86));
}

.admin-summary-card.gold {
  background: linear-gradient(180deg, rgba(248, 239, 208, 0.96), rgba(255, 255, 255, 0.86));
}

.admin-summary-card.stone {
  background: linear-gradient(180deg, rgba(239, 239, 232, 0.96), rgba(255, 255, 255, 0.86));
}

.admin-block-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.timeline-chart {
  min-height: 260px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  align-items: end;
  gap: 10px;
}

.timeline-bar {
  min-height: 220px;
  display: grid;
  gap: 6px;
  align-content: end;
  text-align: center;
}

.timeline-bar strong,
.timeline-bar span,
.timeline-bar small {
  display: block;
}

.timeline-bar strong {
  font-size: 0.88rem;
}

.timeline-bar span,
.timeline-bar small {
  color: var(--muted);
  font-size: 0.76rem;
}

.timeline-bar-stack {
  height: 150px;
  padding: 10px 0;
  display: flex;
  align-items: end;
  justify-content: center;
}

.timeline-bar-fill {
  width: 22px;
  min-height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d8b15b 0%, #2f6d4f 100%);
  box-shadow: 0 8px 18px rgba(47, 109, 79, 0.18);
}

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

.admin-inline-form {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.admin-table th,
.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(49, 70, 56, 0.1);
  text-align: left;
  font-size: 0.88rem;
  vertical-align: middle;
}

.admin-table th {
  color: var(--muted);
  font-weight: 600;
}

.admin-table td {
  color: var(--ink);
}

.table-action-btn {
  padding: 0.54rem 0.9rem;
  font-size: 0.82rem;
  box-shadow: none;
}

.security-panels {
  display: grid;
  gap: 14px;
}

.security-panels section {
  display: grid;
  gap: 8px;
}

.admin-empty {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed rgba(49, 70, 56, 0.18);
  border-radius: 18px;
}

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

@media (max-width: 720px) {
  .admin-hero {
    display: grid;
  }

  .admin-summary-grid,
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-inline-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline-chart {
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  }
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.menu-toggle.is-back {
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-back-icon {
  width: 28px;
  height: 28px;
  color: #fff;
  overflow: visible;
}

.topbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.topbar-pill {
  min-width: 118px;
  padding: 10px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 4px;
}

.topbar-pill-credit {
  background: #28372b;
  color: #fff8e7;
}

.topbar-pill-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.topbar-pill-credit .topbar-pill-label {
  color: rgba(255, 248, 231, 0.78);
}

.topbar-pill strong {
  font-size: 1rem;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 27, 21, 0.28);
  backdrop-filter: blur(3px);
  z-index: 21;
}

.sidebar {
  position: fixed;
  top: 18px;
  left: 18px;
  bottom: 18px;
  width: min(300px, calc(100vw - 36px));
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 251, 243, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  z-index: 22;
  display: grid;
  align-content: start;
  gap: 18px;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ghost-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  width: 100%;
  justify-content: flex-start;
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.sidebar-link.active {
  color: #fff;
  background: var(--accent);
}

.sidebar-logout {
  margin-top: auto;
}

.content-view {
  display: grid;
  gap: 18px;
}

.section-head {
  border-radius: 28px;
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.section-head h3 {
  margin: 0;
  font-size: 1.18rem;
}

.section-head p,
.modal-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.accounts-grid,
.invite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.account-card,
.invite-card,
.referral-item,
.referral-empty,
.empty-card,
.summary-card,
.toggle-row,
.log-item,
.log-empty,
.renew-cost-line,
.renew-tip {
  border: 1px solid var(--line);
  background: var(--card);
}

.account-card,
.invite-card,
.empty-card {
  border-radius: 24px;
  padding: 18px;
}

.account-card {
  display: grid;
  gap: 16px;
  min-height: 248px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 244, 235, 0.92)),
    var(--card);
}

.account-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.account-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-avatar-wrap {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(47, 109, 79, 0.12);
  background: linear-gradient(180deg, rgba(232, 240, 223, 0.9), rgba(247, 237, 213, 0.92));
}

.account-avatar {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.account-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.account-card h4 {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.2;
  word-break: break-all;
}

.account-sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.9rem;
  word-break: break-all;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.chip.expired {
  background: rgba(167, 73, 63, 0.12);
  color: var(--danger);
}

.chip.disabled {
  background: rgba(115, 128, 111, 0.12);
  color: var(--muted);
}

.account-meta {
  display: grid;
  gap: 10px;
}

.account-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 11px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(49, 70, 56, 0.08);
  color: var(--muted);
}

.account-meta-row strong {
  color: var(--ink);
  text-align: right;
  font-size: 0.96rem;
}

.account-actions-grid {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.account-actions-grid button {
  width: 100%;
  min-width: 0;
  padding: 0.58rem 0.2rem;
  border-radius: 14px;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.account-action-toggle {
  color: #fdf8ef;
  background: linear-gradient(180deg, #2d6e54, #214e3c);
}

.account-action-toggle.is-stop {
  background: linear-gradient(180deg, #9a6a48, #7b5035);
}

.account-action-renew {
  color: #5f4732;
  background: linear-gradient(180deg, #f5e7ca, #ecd5aa);
}

.account-action-settings {
  color: #21583f;
  background: linear-gradient(180deg, #e2f0e5, #cadfcf);
}

.account-action-logs {
  color: #5f645a;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(49, 70, 56, 0.1);
}

.account-action-status {
  color: #35516d;
  background: rgba(232, 239, 247, 0.96);
  border: 1px solid rgba(53, 81, 109, 0.12);
}

.empty-card {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.invite-card {
  display: grid;
  gap: 10px;
}

.invite-card strong {
  font-size: 1.06rem;
  line-height: 1.5;
  word-break: break-all;
}

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

.recharge-plan-list {
  display: grid;
  gap: 8px;
  margin-top: -2px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.invite-subordinates {
  display: grid;
  gap: 14px;
}

.subordinates-head h4 {
  margin: 0;
  font-size: 1rem;
}

.referrals-list,
.logs-list {
  display: grid;
  gap: 12px;
}

.referral-item,
.referral-empty,
.log-item,
.log-empty {
  border-radius: 20px;
  padding: 16px 18px;
}

.referral-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.referral-item strong,
.log-item strong {
  display: block;
  font-size: 1rem;
}

.referral-item p,
.referral-empty p,
.log-empty p {
  margin: 6px 0 0;
  color: var(--muted);
}

.log-item {
  display: grid;
  gap: 6px;
}

.log-item span {
  color: var(--muted);
  font-size: 0.88rem;
}

.log-view-head {
  align-items: flex-start;
}

.log-view-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.logs-view-shell {
  border: 1px solid var(--line);
  background: rgba(255, 251, 243, 0.92);
  border-radius: 28px;
  padding: 12px 0;
  overflow: hidden;
}

.land-view-shell {
  border: 1px solid var(--line);
  background: rgba(255, 251, 243, 0.92);
  border-radius: 28px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.land-view-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

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

.land-tile {
  min-height: 66px;
  padding: 4px 4px 5px;
  border: 1px solid rgba(49, 70, 56, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  gap: 2px;
  align-content: start;
}

.land-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  font-size: 0.58rem;
  color: var(--muted);
  line-height: 1;
}

.land-tile-head strong {
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1;
}

.land-tile-name {
  color: var(--ink);
  font-size: 0.62rem;
  line-height: 1.08;
  min-height: 2.16em;
  word-break: break-all;
}

.land-tile-time {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1;
}

.land-harvestable {
  background: linear-gradient(180deg, rgba(235, 246, 229, 0.96), rgba(255, 255, 255, 0.84));
  border-color: rgba(47, 109, 79, 0.22);
}

.land-growing_cd {
  background: linear-gradient(180deg, rgba(249, 239, 214, 0.96), rgba(255, 255, 255, 0.84));
  border-color: rgba(186, 138, 54, 0.2);
}

.land-need_water {
  background: linear-gradient(180deg, rgba(229, 239, 245, 0.96), rgba(255, 255, 255, 0.84));
  border-color: rgba(76, 120, 145, 0.2);
}

.land-empty,
.land-locked,
.land-unknown {
  background: rgba(250, 246, 235, 0.72);
}

.land-locked {
  opacity: 0.72;
}

.land-empty-line {
  color: var(--muted);
  padding: 12px 2px;
  grid-column: 1 / -1;
}

.status-panel {
  border: 1px solid rgba(49, 70, 56, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.status-panel-title {
  padding: 14px 16px;
  color: #705836;
  font-size: 1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(49, 70, 56, 0.08);
}

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

.status-resource-cell {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-right: 1px solid rgba(49, 70, 56, 0.08);
  border-bottom: 1px solid rgba(49, 70, 56, 0.08);
}

.status-resource-cell:nth-child(2n) {
  border-right: 0;
}

.status-resource-cell:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.status-resource-label,
.status-table-label {
  color: #6f715f;
  font-size: 0.98rem;
}

.status-resource-value,
.status-table-value {
  color: #1d251f;
  font-size: 1.12rem;
  font-weight: 700;
}

.status-table {
  display: grid;
}

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

.status-table-item {
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  border-right: 1px solid rgba(49, 70, 56, 0.08);
  border-bottom: 1px solid rgba(49, 70, 56, 0.08);
}

.status-table-item:nth-child(2n) {
  border-right: 0;
}

.status-table-row:last-child .status-table-item {
  border-bottom: 0;
}

.status-table-item.is-placeholder {
  opacity: 0;
}

.status-empty-line {
  padding: 14px 16px;
  color: var(--muted);
}

.logs-stream {
  display: grid;
}

.logs-toolbar {
  padding: 0 18px 12px;
  border-bottom: 1px solid rgba(49, 70, 56, 0.1);
  background: rgba(255, 255, 255, 0.4);
}

.log-line,
.log-empty-line {
  padding: 12px 18px;
  line-height: 1.7;
}

.log-line {
  border-bottom: 1px solid rgba(49, 70, 56, 0.1);
  font-size: 0.95rem;
  word-break: break-word;
}

.log-line:last-child {
  border-bottom: 0;
}

.log-empty-line {
  color: var(--muted);
}

.fab-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  justify-items: end;
  gap: 10px;
  z-index: 20;
}

.fab-menu {
  display: grid;
  gap: 10px;
}

.fab-option {
  min-width: 126px;
  justify-self: end;
  background: rgba(39, 52, 41, 0.96);
}

.fab-main {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 39, 32, 0.28);
  backdrop-filter: blur(3px);
  z-index: 30;
}

.modal {
  position: fixed;
  inset: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  z-index: 31;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  border-radius: 30px;
  padding: 22px;
  scrollbar-width: none;
}

.modal-card::-webkit-scrollbar,
.settings-fields::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.modal-card.narrow {
  width: min(430px, 100%);
}

.modal-card.wide {
  width: min(1080px, 100%);
}

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

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: rgba(247, 237, 213, 0.96);
  color: var(--ink);
  box-shadow: none;
}

.renew-tip,
.renew-cost-line {
  border-radius: 18px;
  padding: 14px 16px;
}

.renew-tip {
  color: var(--muted);
  line-height: 1.7;
}

.renew-cost-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.button-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.login-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.login-screen {
  display: grid;
  gap: 16px;
}

.login-screen-head h4,
.login-detail-empty h4,
.login-detail-head h4 {
  margin: 0;
}

.login-screen-head p,
.login-detail-empty p,
.login-detail-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-detail-topbar {
  display: flex;
  justify-content: flex-start;
}

.qr-login-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(47, 109, 79, 0.14);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
}

.qr-login-preview {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 244, 235, 0.92), rgba(232, 240, 223, 0.92));
}

.qr-login-image {
  width: min(100%, 260px);
  height: auto;
  border-radius: 20px;
  box-shadow: 0 16px 32px rgba(39, 52, 41, 0.12);
}

.qr-login-placeholder {
  color: var(--muted);
  line-height: 1.8;
  text-align: center;
}

.qr-login-copy {
  display: grid;
  gap: 6px;
}

.qr-login-copy strong {
  font-size: 1.04rem;
}

.qr-login-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.qr-login-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-back {
  padding-inline: 1rem;
}

.login-method {
  border-radius: 24px;
  border: 1px solid rgba(47, 109, 79, 0.16);
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  padding: 18px 16px 16px;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 138px;
}

.login-method.selected {
  border-color: rgba(47, 109, 79, 0.46);
  background: rgba(232, 240, 223, 0.86);
}

.login-method.disabled {
  opacity: 0.72;
}

.login-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: contain;
}

.login-hint {
  color: var(--accent);
  font-size: 0.84rem;
}

.settings-layout {
  display: grid;
  gap: 18px;
}

.settings-save-fab {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(255, 251, 243, 0), rgba(255, 251, 243, 0.82) 26%, rgba(255, 251, 243, 0.98));
}

.settings-save-btn {
  min-width: 104px;
  min-height: 46px;
  padding: 0.72rem 1.08rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  background: linear-gradient(180deg, #2f7a56, #245d42);
  box-shadow: 0 14px 26px rgba(47, 109, 79, 0.18);
}

.meta-label {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.settings-fields {
  display: grid;
  gap: 12px;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.accordion-group {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(250, 246, 235, 0.74);
  overflow: hidden;
}

.accordion-toggle {
  width: 100%;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.accordion-toggle:hover {
  transform: none;
}

.accordion-meta {
  display: grid;
  gap: 4px;
}

.accordion-meta small,
.accordion-arrow {
  color: var(--muted);
}

.accordion-body {
  padding: 4px 18px 16px;
  display: grid;
  gap: 10px;
}

.field-row {
  display: grid;
  gap: 10px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px dashed rgba(49, 70, 56, 0.12);
}

.field-row:first-child {
  border-top: 0;
}

.field-row span {
  color: var(--ink);
  line-height: 1.65;
}

.field-copy {
  display: grid;
  gap: 4px;
}

.field-help {
  color: var(--muted);
  line-height: 1.6;
}

.nested-field {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 2px solid rgba(47, 109, 79, 0.12);
}

.field-row:has(input[type="checkbox"]) {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.switch-control {
  position: relative;
  width: 52px;
  height: 30px;
  justify-self: end;
}

.switch-control input[type="checkbox"] {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(115, 128, 111, 0.26);
  transition: background 160ms ease;
}

.switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 14px rgba(29, 43, 33, 0.16);
  transition: transform 160ms ease;
}

.switch-control input[type="checkbox"]:checked + .switch-slider {
  background: #6177eb;
}

.switch-control input[type="checkbox"]:checked + .switch-slider::after {
  transform: translateX(22px);
}

.field-row input:not([type="checkbox"]),
.field-row select {
  width: 100%;
  padding: 0.78rem 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
}

.range-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-picker,
.searchable-select {
  display: grid;
  gap: 10px;
}

.option-listbox {
  --option-row-height: 34px;
  --option-row-gap: 4px;
  max-height: calc((var(--option-row-height) * 10) + (var(--option-row-gap) * 9) + 16px);
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--option-row-gap);
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(49, 70, 56, 0.12);
  background: rgba(255, 255, 255, 0.82);
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.option-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: var(--option-row-height);
  padding: 4px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.option-row:hover {
  background: rgba(244, 249, 244, 0.88);
}

.option-row.selected {
  background: rgba(228, 244, 232, 0.95);
}

.option-row input {
  margin: 0;
  width: 22px;
  height: 22px;
  border: 1.5px solid rgba(49, 70, 56, 0.24);
  border-radius: 6px;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  flex-shrink: 0;
  position: relative;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.option-row input:checked {
  border-color: #2e7cf6;
  background-color: #2e7cf6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='white' d='M6.2 11.6 2.9 8.3l1.2-1.2 2.1 2.1 5.7-5.7 1.2 1.2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

.option-row input:focus-visible {
  box-shadow: 0 0 0 3px rgba(46, 124, 246, 0.16);
}

.option-row span {
  min-width: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-search-input,
.logs-search-input {
  width: 100%;
  padding: 0.78rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(49, 70, 56, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}

.settings-search-input::placeholder,
.logs-search-input::placeholder {
  color: rgba(95, 100, 90, 0.88);
}

.choice-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(49, 70, 56, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.choice-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 109, 79, 0.28);
}

.choice-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice-pill span {
  color: var(--muted);
  font-size: 0.95rem;
}

.choice-pill.selected,
.choice-pill:has(input:checked) {
  border-color: rgba(47, 109, 79, 0.4);
  background: rgba(228, 244, 232, 0.95);
}

.choice-pill.selected span,
.choice-pill:has(input:checked) span {
  color: var(--ink);
}

.choice-empty {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.demand-editor {
  display: grid;
  gap: 12px;
}

.demand-editor-list {
  display: grid;
  gap: 10px;
}

.demand-editor-item,
.demand-editor-add {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(88px, 0.7fr) auto;
  gap: 10px;
  align-items: center;
}

.demand-editor-item select,
.demand-editor-item input,
.demand-editor-add select,
.demand-editor-add input {
  width: 100%;
}

.searchable-select select {
  width: 100%;
}

.demand-remove-btn,
.demand-add-btn {
  min-height: 44px;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 92px;
  max-width: 320px;
  padding: 14px 18px;
  border-radius: 18px;
  color: #fff;
  background: #273429;
  box-shadow: var(--shadow);
  z-index: 40;
}

@media (max-width: 960px) {
  .dashboard {
    width: min(100%, calc(100% - 20px));
    padding-bottom: 92px;
  }

  .section-head,
  .modal-head {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-right,
  .button-row {
    flex-wrap: wrap;
  }

  .topbar-context {
    max-width: 28vw;
    font-size: 1rem;
  }

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

  .demand-editor-item,
  .demand-editor-add {
    grid-template-columns: minmax(0, 1fr) 120px;
  }

  .demand-remove-btn,
  .demand-add-btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .auth-layout {
    padding: 14px;
  }

  .auth-card,
  .shell-topbar,
  .section-head,
  .modal-card {
    border-radius: 24px;
  }

  .auth-card,
  .shell-topbar,
  .section-head,
  .modal-card {
    padding: 18px;
  }

  .dashboard {
    width: calc(100% - 14px);
    gap: 14px;
    padding-top: 14px;
  }

  .accounts-grid,
  .invite-grid,
  .settings-summary {
    grid-template-columns: 1fr;
  }

  .topbar-context {
    max-width: 34vw;
    font-size: 0.9rem;
  }

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

  .shell-topbar.detail-topbar .topbar-context {
    position: static;
    left: auto;
    transform: none;
    max-width: none;
    padding: 0;
    font-size: 1rem;
    line-height: 1.2;
    text-align: left;
  }

  .shell-topbar.detail-topbar .topbar-right {
    justify-self: end;
  }

  .shell-topbar.detail-topbar .topbar-right .topbar-pill:first-child {
    display: none;
  }

  .shell-topbar.detail-topbar .topbar-pill {
    min-width: 92px;
  }

  .field-row input:not([type="checkbox"]),
  .field-row select,
  .settings-search-input,
  .logs-search-input {
    font-size: 16px;
  }


  .settings-save-btn {
    min-width: 92px;
    min-height: 42px;
    padding: 0.64rem 0.96rem;
    font-size: 0.84rem;
  }

  .account-card {
    padding: 16px;
    gap: 14px;
  }

  .account-card-head {
    gap: 10px;
  }

  .account-identity {
    gap: 10px;
  }

  .account-avatar-wrap {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 16px;
  }

  .account-avatar {
    width: 32px;
    height: 32px;
  }

  .account-card h4 {
    font-size: 0.98rem;
  }

  .account-sub {
    font-size: 0.82rem;
  }

  .chip {
    font-size: 0.72rem;
    padding: 0.3rem 0.58rem;
  }

  .account-meta-row {
    padding: 10px 11px;
    font-size: 0.84rem;
  }

  .account-meta-row strong {
    font-size: 0.88rem;
  }

  .account-actions-grid {
    gap: 6px;
  }

  .account-actions-grid button {
    padding: 0.5rem 0.08rem;
    font-size: 0.72rem;
    border-radius: 12px;
  }

  .land-view-shell {
    padding: 8px 6px;
    gap: 6px;
  }

  .land-grid {
    gap: 2px;
  }

  .land-tile {
    min-height: 54px;
    padding: 3px 2px 4px;
    border-radius: 10px;
  }

  .land-tile-head {
    font-size: 0.5rem;
  }

  .land-tile-head strong {
    font-size: 0.64rem;
  }

  .land-tile-name {
    font-size: 0.54rem;
    line-height: 1.02;
    min-height: 2.04em;
  }

  .land-tile-time {
    font-size: 0.5rem;
  }

  .status-panel-title {
    padding: 11px 12px;
    font-size: 0.92rem;
  }

  .status-resource-cell,
  .status-table-item {
    padding: 10px 12px;
    min-height: 44px;
    gap: 8px;
  }

  .status-resource-label,
  .status-table-label {
    font-size: 0.86rem;
  }

  .status-resource-value,
  .status-table-value {
    font-size: 0.94rem;
  }

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

  .qr-login-preview {
    min-height: 208px;
  }

  .referral-item,
  .meta-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .field-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .field-row:has(input[type="checkbox"]) {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .range-pair {
    grid-template-columns: 1fr;
  }

  .demand-editor-item,
  .demand-editor-add {
    grid-template-columns: 1fr;
  }

  .fab-wrap {
    right: 14px;
    bottom: 14px;
  }

  .sidebar {
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .toast {
    right: 14px;
    left: 14px;
    bottom: 82px;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .login-methods {
    grid-template-columns: 1fr;
  }
}

@supports (-webkit-touch-callout: none) {
  .field-row input:not([type="checkbox"]),
  .field-row select,
  .settings-search-input,
  .logs-search-input {
    font-size: 16px;
  }

  .option-listbox {
    transform: translateZ(0);
  }
}
