:root {
  --bg: #0b0e20;
  --surface: #151936;
  --surface-2: #1b2044;
  --surface-3: #232a55;
  --border: #2b3266;
  --text: #e9ebf7;
  --muted: #a3a9c9;
  --accent: #5b5ef4;
  --accent-hover: #6f72ff;
  --green: #2f9e5e;
  --red: #d64545;
  --yellow: #d9a441;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", Roboto, system-ui, sans-serif;
}

a { color: var(--accent-hover); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.brand-mark { width: 34px; height: 34px; color: var(--accent-hover); }

.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user img { border-radius: 50%; }

.view { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}

.card h1 { margin: 0 0 4px; font-size: 26px; }
.card h2 { margin: 0 0 6px; font-size: 21px; }
.card .sub { color: var(--muted); margin: 0; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.hero svg { width: 110px; height: 110px; color: #2f3768; flex: none; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 15px;
}
.notice .icon { color: var(--accent-hover); flex: none; font-size: 20px; line-height: 1.2; }
.notice p { margin: 0 0 4px; }
.notice p:last-child { margin-bottom: 0; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 14px; }

.guild-grid { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; }

.guild-card {
  width: 168px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
}
.guild-card img, .guild-initial {
  width: 96px; height: 96px; border-radius: 50%; display: block; margin: 0 auto 12px;
}
.guild-initial {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); font-size: 32px; font-weight: 700; color: var(--muted);
}
.guild-card .name { font-weight: 600; margin-bottom: 12px; word-break: break-word; }

.layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.side a {
  display: block; padding: 10px 12px; border-radius: 8px; color: var(--muted);
  text-decoration: none; margin-bottom: 4px;
}
.side a:hover { background: var(--surface-2); color: var(--text); }
.side a.active { background: var(--accent); color: #fff; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.section-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
}
.section-item .title { font-weight: 600; }
.section-item a.title { color: var(--text); text-decoration: none; }
.section-item a.title:hover { color: var(--accent-hover); }

.pill { font-size: 12px; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); }
.pill.on { background: rgba(47,158,94,.18); border-color: var(--green); color: #7ee2a8; }
.pill.off { background: rgba(214,69,69,.14); border-color: var(--red); color: #ffb3b3; }

.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 80px; resize: vertical; }
select[multiple] { min-height: 130px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

.object-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
}
.object-card .num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 28px; }
.object-card .obj-name { font-weight: 600; }
.object-card .obj-desc { color: var(--muted); font-size: 14px; }
.object-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--surface-3); }

.modal-field {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px;
  background: var(--surface);
}

.empty { color: var(--muted); padding: 18px 0; }
.error-text { color: #ffb3b3; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 20px; z-index: 60; max-width: 90vw;
}
.toast.bad { border-color: var(--red); }
.toast.good { border-color: var(--green); }

.dialog {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; width: min(640px, 94vw);
}
.dialog::backdrop { background: rgba(4,6,18,.72); }
.dialog h3 { margin: 0 0 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.stale-list { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }