:root {
  --bg: #fff7d8;
  --panel: #fffdf4;
  --panel-strong: #fff1bd;
  --ink: #211707;
  --muted: #78633f;
  --line: #ead8a3;
  --accent: #ffd728;
  --accent-soft: #fff2b8;
  --gold: #c58b36;
  --red: #ad4e32;
  --shadow: 0 18px 50px rgba(73, 62, 39, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #17120a;
}

.login-card {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 253, 248, 0.14);
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.22);
}

.login-brand {
  color: var(--ink);
}

.login-brand .brand-subtitle {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #5b4c34;
  font-size: 13px;
  font-weight: 700;
}

.login-form .primary-button {
  width: 100%;
  margin-top: 8px;
}

.login-message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--red);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 260px;
  height: 100vh;
  padding: 24px 18px;
  background: #17120a;
  color: #f9f4e8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: #f2d27a;
  color: #17120a;
  font-size: 24px;
  font-weight: 800;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: rgba(249, 244, 232, 0.68);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(249, 244, 232, 0.72);
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(242, 210, 122, 0.16);
  color: #fffdf8;
}

.server-card {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(249, 244, 232, 0.12);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.08);
}

.server-card strong,
.server-card span {
  display: block;
}

.server-card strong {
  font-size: 13px;
}

.server-card span {
  margin-top: 2px;
  color: rgba(249, 244, 232, 0.62);
  font-size: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffd728;
  box-shadow: 0 0 0 5px rgba(255, 215, 40, 0.2);
}

.main {
  min-width: 0;
  flex: 1;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  padding: 0 18px;
  background: var(--accent);
  color: #17120a;
  box-shadow: 0 10px 24px rgba(214, 158, 0, 0.22);
}

.secondary-button {
  padding: 0 14px;
  background: var(--accent-soft);
  color: #765300;
  border-color: #efd479;
}

.ghost-button {
  padding: 0 14px;
  background: #fffdf8;
  color: var(--ink);
  border-color: var(--line);
}

.small-button {
  min-height: 30px;
  padding: 0 10px;
  background: #fff;
  color: var(--red);
  border-color: #ead0c6;
}

.section {
  display: none;
}

.active-section {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 20px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(460px, 1.4fr);
  gap: 18px;
}

.manager-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(620px, 1.6fr);
  gap: 18px;
  align-items: start;
}

.manager-sidebar-panel,
.manager-detail-panel {
  min-height: 520px;
}

.parent-editor-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #ebe3d6;
  border-radius: 14px;
  background: #fffaf0;
  cursor: pointer;
}

.parent-editor-card.active {
  border-color: #ffd728;
  background: #fff7d8;
  box-shadow: inset 4px 0 0 var(--accent);
}

.parent-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.parent-card-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.parent-card-form label {
  display: grid;
  gap: 6px;
  color: #5b4c34;
  font-size: 13px;
  font-weight: 700;
}

.panel {
  min-width: 0;
  padding: 20px;
}

.panel.wide {
  grid-column: span 1;
}

.section-gap {
  margin-top: 18px;
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #fffdf8;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #ebe3d6;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: var(--panel-strong);
  color: #5b4c34;
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #d9a900;
  box-shadow: 0 0 0 3px rgba(255, 215, 40, 0.2);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.toggle input {
  width: 18px;
  min-height: 18px;
}

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

.form-field label {
  display: block;
  margin-bottom: 7px;
  color: #5b4c34;
  font-size: 13px;
  font-weight: 700;
}

.readiness-list,
.quote-list {
  display: grid;
  gap: 10px;
}

.readiness-item,
.quote-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #ebe3d6;
  border-radius: 12px;
  background: #fffaf0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #765300;
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  min-height: 150px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed #d8cfbf;
  border-radius: 14px;
  background: #fffaf0;
}

.image-uploader {
  display: grid;
  gap: 8px;
  width: 132px;
}

.wide-uploader {
  width: 180px;
}

.upload-preview {
  display: block;
  width: 132px;
  height: 82px;
  object-fit: cover;
  border: 1px solid #d8cfbf;
  border-radius: 10px;
  background: #f7f0e4;
}

.wide-uploader .upload-preview {
  width: 180px;
  height: 180px;
}

.upload-preview.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.upload-actions {
  display: flex;
  gap: 6px;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #efd479;
  border-radius: 9px;
  background: var(--accent-soft);
  color: #765300;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.upload-button input {
  display: none;
}

.multi-image-uploader {
  display: grid;
  gap: 10px;
  min-width: 180px;
}

.multi-image-list {
  display: grid;
  gap: 10px;
}

.multi-image-item {
  display: grid;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ebe3d6;
}

.multi-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.quote-detail-card {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffaf0;
}

.quote-filter-bar {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(150px, 0.8fr)) repeat(2, minmax(140px, 0.7fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #ebe3d6;
  border-radius: 14px;
  background: #fffaf0;
}

.quote-filter-bar label {
  display: grid;
  gap: 7px;
  color: #5b4c34;
  font-size: 13px;
  font-weight: 700;
}

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

.result-count {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.quote-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ebe3d6;
}

.quote-detail-head h3 {
  margin: 0;
  font-size: 18px;
}

.quote-detail-head strong {
  color: var(--red);
  font-size: 22px;
}

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

.quote-detail-grid h4 {
  margin: 0 0 8px;
  color: #5b4c34;
}

.quote-detail-grid p {
  margin: 0 0 5px;
  color: var(--ink);
}

.quote-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.quote-line img {
  width: 44px;
  height: 34px;
  object-fit: cover;
  border: 1px solid #e1d9c9;
  border-radius: 8px;
  background: #fff;
  flex: 0 0 auto;
}

.quote-line p {
  margin: 0;
}

.quote-fees {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 16px;
}

.quote-fees h4 {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 12px;
  background: #17120a;
  color: #fffdf8;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1000px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: auto;
    height: auto;
  }

  .server-card {
    position: static;
    margin-top: 18px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stats-grid,
  .content-grid,
  .manager-grid,
  .form-grid,
  .quote-detail-grid,
  .quote-fees,
  .quote-filter-bar {
    grid-template-columns: 1fr;
  }

  .quote-fees {
    grid-column: span 1;
  }
}
