@font-face{font-family:Inter;src:url('/fonts/sans/inter-latin-400-normal.woff2') format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:Inter;src:url('/fonts/sans/inter-latin-500-normal.woff2') format('woff2');font-weight:500;font-display:swap}
@font-face{font-family:Inter;src:url('/fonts/sans/inter-latin-600-normal.woff2') format('woff2');font-weight:600;font-display:swap}
@font-face{font-family:Inter;src:url('/fonts/sans/inter-latin-700-normal.woff2') format('woff2');font-weight:700;font-display:swap}
@font-face{font-family:Cormorant;src:url('/fonts/serif/cormorant-garamond-latin-700-normal.woff2') format('woff2');font-weight:700;font-display:swap}

:root {
  --sidebar: #172220;
  --sidebar-line: #34403a;
  --paper: #f5f2eb;
  --surface: #fcfaf5;
  --line: #ddd7c9;
  --ink: #23291f;
  --muted: #615e54;
  --gold: #be9a61;
  --gold-light: #ead3a6;
  --serif: Cormorant, Georgia, serif;
  --sidebar-width: 232px;
  font: 16px/1.55 Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.02; overflow-wrap: anywhere; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .66; }
:focus-visible { outline: 2px solid #947040; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: fixed; z-index: 10; top: 1rem; left: 1rem; padding: .6rem 1rem; background: var(--surface); transform: translateY(-200%); }
.skip:focus { transform: none; }
.icon { width: 1.15em; height: 1.15em; flex: none; display: inline-block; background: currentColor; mask: var(--icon) center / contain no-repeat; }
.compass { --icon: url('/icons/compass.svg'); }
.chevron-right { --icon: url('/icons/chevron-right.svg'); }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 2; width: var(--sidebar-width); display: flex; flex-direction: column;
  color: #e5e0d2; background: radial-gradient(ellipse at 0 0, #27342c, transparent 62%), var(--sidebar);
  border-right: 1px solid #35413b;
}
.brand { display: flex; align-items: center; gap: 12px; margin: 25px 19px 23px; padding: 4px 6px 25px; border-bottom: 1px solid var(--sidebar-line); font: 700 30px/.78 var(--serif); color: #f7ead2; }
.brand em { color: var(--gold); font-style: normal; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; flex: none; border: 1px solid #95764c; border-radius: 50%; color: #d4b479; box-shadow: inset 0 0 0 3px #26312b, inset 0 0 0 4px #68583f; }
.brand-mark .icon { font-size: 23px; }
.sidebar-body { padding: 0 16px; }
.nav-label { margin: 2px 9px 10px; color: #a9afa0; font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; font-weight: 600; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 12px 11px; min-height: 44px; border-radius: 5px; border: 1px solid transparent; color: #d4d8cc; font-size: .9rem; font-weight: 500; }
.sidebar nav a .icon { font-size: 1.05rem; color: #adb6a7; }
.sidebar nav a:hover, .sidebar-profile:hover { background: #ffffff10; }
.sidebar nav [aria-current='page'] { background: #b4966130; color: #fae8be; border-color: #b496614d; }
.sidebar nav [aria-current='page'] .icon { color: #e0be83; }
.sidebar-account { margin: auto 16px 16px; padding-top: 15px; border-top: 1px solid var(--sidebar-line); }
.sidebar-profile { display: flex; align-items: center; width: 100%; gap: 10px; text-align: left; color: inherit; background: transparent; border: 0; border-radius: 5px; padding: 7px; font-size: .85rem; }
.sidebar-profile strong, .sidebar-profile small { display: block; }
.sidebar-profile small { color: #adb6a7; font-size: .75rem; }
.sidebar-profile .icon:last-child { margin-left: auto; color: #adad9d; }

.workspace { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 4vw, 58px); background: var(--surface); border-bottom: 1px solid var(--line); }
.breadcrumb, .topbar-actions, .actions { display: flex; align-items: center; gap: 10px; }
.breadcrumb { color: var(--muted); font-size: .85rem; }
.breadcrumb .icon { font-size: .75rem; color: #8b836e; }
.breadcrumb strong { color: var(--ink); }
.mobile-brand { display: none; }
.topbar-actions { gap: 13px; }
.top-profile { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #c6b289; border-radius: 50%; }
.top-profile .avatar { width: 34px; height: 34px; border-radius: 50%; }
.square { display: inline-grid; position: relative; place-items: center; width: 40px; height: 40px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; }
.square:hover { background: #ebe5d8; }
.notification span { position: absolute; width: 7px; height: 7px; border-radius: 50%; top: 8px; right: 8px; background: #a26432; box-shadow: 0 0 0 2px var(--surface); }

main { max-width: 1380px; margin: 0 auto; padding: 28px clamp(24px, 4vw, 58px) 36px; }
main:focus { outline: none; }
.page-heading { display: flex; gap: 14px; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.page-heading h1 { font-size: clamp(2.7rem, 4vw, 3.4rem); letter-spacing: -.035em; }
.page-heading p { color: var(--muted); margin-top: 6px; }
.hero {
  position: relative; min-height: 330px; isolation: isolate; overflow: hidden; display: flex; align-items: center;
  padding: 34px clamp(32px, 4vw, 60px); border: 1px solid #544936; border-radius: 8px; color: #fcf3df;
  background: linear-gradient(90deg, #101a18f5 1%, #15201be0 25%, #18211b70 56%, #151e1c05 90%),
    url('/assets/western-marches.webp') center 51% / cover no-repeat, #273229;
  box-shadow: 0 3px 9px #251a1720;
}
.hero::before { content: ''; position: absolute; z-index: -1; inset: 9px; border: 1px solid #ebd4a341; border-radius: 3px; pointer-events: none; }
.hero-content { max-width: 475px; }
.hero-location { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; color: #f1d6a7; font-size: .75rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }
.hero-location span { width: 7px; height: 7px; background: #dbb879; transform: rotate(45deg); }
.hero h2 { font-size: clamp(3.2rem, 5.4vw, 5.1rem); line-height: .92; letter-spacing: -.035em; text-wrap: balance; }
.hero p { max-width: 345px; color: #f1e6d1; margin: 14px 0 23px; text-wrap: pretty; }
.hero .actions { flex-wrap: wrap; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 14px; border: 1px solid transparent; border-radius: 5px; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.primary { background: #293e35; color: #faf6ec; border-color: #293e35; }
.primary:hover { background: #3b5649; }
.secondary { background: #faf7ef; color: #3c372c; border-color: #d5ccba; }
.secondary:hover { background: #eee6d7; }
.gold { background: #e0bd81; color: #241e14; border-color: #edcd93; }
.gold:hover { background: #edcf99; }
.hero-secondary { border-color: #d6bd8d; background: #1b211da6; color: #f3e4c5; }
.hero-secondary:hover { background: #384638; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin: 18px 0 20px; }
.stat, .panel { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 2px 3px #34271508; }
.stat { display: flex; align-items: flex-start; gap: 13px; padding: 16px; }
.stat:hover { border-color: #a9936d; }
.stat-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 5px; }
.stat-icon.blue { color: #375c57; background: #e1eae3; }
.stat-icon.amber { color: #76541f; background: #f3e8d1; }
.stat-icon.red { color: #814b48; background: #efdfd9; }
.stat-label, .stat small { display: block; color: var(--muted); }
.stat-label { font-size: .83rem; font-weight: 600; }
.stat strong { display: block; font: 700 2.15rem/1 var(--serif); margin: 2px 0 5px; overflow-wrap: anywhere; }
.stat .numeric-value { font: 600 1.85rem/1.15 Inter, system-ui, sans-serif; }
.stat .text-value { font-size: clamp(1.35rem, 2.15vw, 1.9rem); margin-top: 5px; }
.stat small { font-size: .77rem; }

.overview-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; align-items: start; }
.page-panels { display: grid; gap: 16px; }
.panel { min-width: 0; padding: 0 18px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.panel-header h2 { font-size: 1.95rem; letter-spacing: -.02em; }
.panel-header p { color: var(--muted); font-size: .83rem; margin-top: 4px; }
.panel-header .button, .row .button { min-height: 38px; font-size: .8rem; }
.count { color: var(--muted); background: #eee8db; border-radius: 99px; font-size: .85rem; padding: 3px 10px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 11px; min-height: 65px; padding: 9px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row-content { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.row-content strong, .row-content small { display: block; }
.row-content strong { font-size: .9rem; }
.row-content small, .guild-directory small { color: var(--muted); font-size: .8rem; }
.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 5px; background: #e8decb; color: #53432d; font-weight: 600; font-size: .72rem; }
.portrait { display: block; object-fit: cover; }
.tone-0 { color: #674237; background: #e9d8ce; }
.tone-1 { color: #3f5847; background: #dde5d7; }
.tone-2 { color: #49576b; background: #e0e5ea; }
.tone-3 { color: #6c5232; background: #eae0cc; }
.empty { color: var(--muted); padding: 17px 0; }
.guild-preview { padding: 16px 0; }
.guild-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crest { display: grid; width: 47px; height: 54px; flex: none; place-items: center; padding-bottom: 6px; color: #f1d19a; background: #6b4034; clip-path: polygon(0 0, 100% 0, 100% 74%, 50% 100%, 0 74%); }
.crest .icon { font-size: 1.35rem; }
.heraldry-1 { background: #3d5a49; }
.heraldry-2 { background: #674b37; }
.guild-identity h3 { font-size: 1.6rem; }
.guild-identity p { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.guild-meta { display: flex; flex-wrap: wrap; gap: 8px 17px; padding-top: 15px; margin-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.guild-meta span { display: inline-flex; align-items: center; gap: 6px; }
.guild-directory .row { justify-content: space-between; }
.guild-directory-actions { display: flex; gap: 12px; align-items: center; flex: none; }

dialog { position: fixed; width: min(440px, calc(100% - 32px)); max-height: calc(100% - 36px); padding: 0; border: 1px solid #b6a986; border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: 0 12px 45px #0005; }
dialog::backdrop { background: #111b17b0; }
dialog form { position: relative; padding: 27px; }
dialog h2 { margin-right: 40px; font-size: 2.45rem; }
dialog p { color: var(--muted); margin: 9px 0 17px; }
.dialog-close { position: absolute; top: 14px; right: 14px; }
dialog label { display: block; font-weight: 600; margin: 13px 0; }
dialog label[for='password'] { margin-bottom: 4px; }
dialog #password-hint { display: block; color: var(--muted); margin-top: 4px; }
dialog form > [type='submit'] { margin-top: 13px; }
dialog label small { color: var(--muted); font-weight: 400; }
dialog input, dialog textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 4px; border: 1px solid #b7ad98; background: #fffdf8; color: var(--ink); }
dialog textarea { resize: vertical; }
dialog .form-error { color: #89382c; }
.text-button { display: block; padding: 12px 0 0; border: 0; background: none; text-decoration: underline; color: #4c5b43; font-size: .875rem; }
#notice:not(:empty) { position: fixed; z-index: 3; right: 22px; bottom: 22px; max-width: min(420px, calc(100% - 44px)); border: 1px solid #687866; border-radius: 6px; background: #25372e; color: #fff4dc; padding: 12px 16px; box-shadow: 0 3px 10px #0003; }

@media (max-width: 1000px) {
  :root { --sidebar-width: 188px; }
  .brand { font-size: 27px; }
  .stat { gap: 9px; padding: 12px; }
  .stat-icon { width: 32px; height: 32px; }
}

@media (max-width: 800px) {
  .sidebar { inset: auto 0 0; width: auto; border-right: 0; border-top: 1px solid var(--sidebar-line); padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); }
  .sidebar-body { padding: 0; }
  .brand, .nav-label, .sidebar-account, .breadcrumb { display: none; }
  .sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .sidebar nav a { justify-content: center; gap: 7px; padding: 9px 5px; }
  .workspace { margin-left: 0; }
  .topbar { height: 58px; background: var(--sidebar); color: #f7ead2; border-color: var(--sidebar-line); }
  .mobile-brand { display: flex; align-items: center; gap: 9px; font: 700 clamp(1.4rem, 4.5vw, 1.75rem)/1 var(--serif); }
  .mobile-brand .brand-mark { width: 32px; height: 32px; }
  .mobile-brand .brand-mark .icon { font-size: 17px; }
  .topbar-actions { gap: 8px; }
  .topbar .square, .topbar .secondary { color: #f7ead2; border-color: #647064; background: #27342c; }
  .topbar .notification span { box-shadow: 0 0 0 2px #27342c; background: #e1bd86; }
  main { padding-bottom: calc(73px + env(safe-area-inset-bottom)); }
  #notice:not(:empty) { bottom: calc(66px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .topbar { padding: 0 15px; }
  main { padding: 22px 15px calc(73px + env(safe-area-inset-bottom)); }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 16px; }
  .page-heading h1 { font-size: 2.65rem; }
  .page-heading p { margin-top: 4px; }
  .hero { min-height: 308px; align-items: end; padding: 27px 23px; background-image: linear-gradient(0deg, #131a16f5 1%, #17201bdd 24%, #18211970 55%, #18211a00 95%), url('/assets/western-marches.webp'); background-position: center, 61% 50%; }
  .hero h2 { font-size: clamp(2.65rem, 10vw, 3.5rem); text-wrap: initial; }
  .hero p { margin: 10px 0 16px; }
  .hero-location { font-size: .71rem; margin-bottom: 10px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 11px 0 13px; }
  .stat:last-child { grid-column: 1 / -1; }
  .stat .text-value { font-size: 1.6rem; }
  .overview-panels { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 0 12px; }
  .panel-header .button, .row .button { min-height: 44px; padding-inline: 9px; }
  .guild-directory-actions { flex-direction: column; align-items: end; gap: 5px; }
}

@media (max-width: 350px) {
  .topbar, main { padding-inline: 11px; }
  .row { gap: 7px; }
  .row .actions { gap: 4px; }
  .nav-label { font-size: .7rem; }
}
