:root {
  color-scheme: dark;
  --nav-width: 232px;
  --canvas: #101113;
  --side: #141517;
  --surface: #191a1d;
  --raised: #202124;
  --field: #131417;
  --line: #353233;
  --line-soft: #2b2a2b;
  --ink: #f0e8dc;
  --muted: #beb4a8;
  --soft: #a99e93;
  --gold: #e5b77f;
  --gold-bright: #f4c892;
  --amber: #efbb82;
  --green: #b7d5b4;
  --danger: #ffc3b7;
  --radius: 12px;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --serif: 'Spectral', Georgia, serif;
  font-family: var(--sans);
  font-size: 16px;
  font-optical-sizing: auto;
  background: var(--canvas);
  color: var(--ink);
  scrollbar-color: #635446 #18191b;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
a { color: var(--gold-bright); }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
p { line-height: 1.5; }
dl, ul { margin: 0; }
.icon { inline-size: 1.1rem; block-size: 1.1rem; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.subtle { color: var(--muted); }
.private-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.dated { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: .87rem; }
.dated .icon { width: .9rem; height: .9rem; }
.wide { grid-column: 1 / -1; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 39px; min-width: 0; padding: .55rem .82rem;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  line-height: 1.24; text-align: center; font-weight: 600; font-size: .94rem; overflow-wrap: anywhere;
}
.button.primary { background: #d9a974; color: #18130f; border-color: #e6ba8a; box-shadow: inset 0 1px #f3c892; }
.button.primary:hover { background: #edc394; }
.button.outline { background: #28231e; color: #f2d2ad; border-color: #63513b; }
.button.outline:hover { background: #332a22; border-color: #ad8051; }
.button.quiet:hover, .button.success-quiet:hover { background: #302b28; }
.button.danger-quiet { color: #f0b0a3; }
.button.danger-quiet:hover { background: #3a2725; }
.button.danger { background: #57332e; border-color: #a16459; color: #ffe0d8; }
.button.danger:hover { background: #69403a; }
.button.success-quiet { color: #d2e9ce; border-color: #58725a; background: #263c2b; }
.button.icon-button { width: 38px; height: 38px; min-height: 38px; padding: 0; }
.button:disabled:hover { filter: none; }
.button.name-link { color: #f0d3af; padding: 0; min-height: 32px; font-weight: 700; text-align: left; }

.sidebar {
  position: fixed; z-index: 3; inset: 0 auto 0 0; width: var(--nav-width);
  display: flex; flex-direction: column; padding: 24px 13px 14px;
  background: linear-gradient(162deg,#20201f 0%,#17181a 44%,#141517 100%);
  border-right: 1px solid #34302d; overflow: auto;
}
.sidebar .wordmark {
  min-height: 62px; display: flex; justify-content: flex-start; gap: 12px;
  padding: 6px 8px; margin-bottom: 24px; text-align: left;
}
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto;
  background: #2d261f; color: var(--gold); border: 1px solid #755b40; border-radius: 9px;
}
.brand-mark .icon { width: 27px; height: 27px; stroke-width: 1.25; }
.wordmark-type { display: grid; gap: 1px; }
.wordmark-type strong { font: 600 1.68rem/.95 var(--serif); color: #ecd0aa; letter-spacing: -.025em; }
.wordmark-type small { color: #bba895; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.nav-items { display: grid; gap: 5px; }
.sidebar .nav-link {
  position: relative; width: 100%; justify-content: flex-start; min-height: 47px; gap: 11px;
  padding: 8px 11px; text-align: left; color: #d2c7ba;
}
.nav-link > .icon { color: #b7a796; }
.sidebar .nav-link.current {
  background: #30261f; color: #f3c898; border: 1px solid #614a34;
}
.nav-link.current::before { content: ''; position: absolute; inset: 10px auto 10px -1px; width: 2px; border-radius: 2px; background: #ddad75; }
.nav-link.current .icon { color: #efbb83; }
.nav-backup-due { margin-inline-start: auto; width: 8px; height: 8px; border-radius: 50%; background: #efa85c; box-shadow: 0 0 0 3px #96633755; flex: 0 0 auto; }
.sidebar-foot { margin-top: auto; padding-top: 25px; }
.language-control { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #111214; }
.language-control .lang { min-height: 35px; font-size: .83rem; color: var(--muted); padding: 7px 5px; }
.language-control .lang.selected { color: #f3cf9f; background: #302820; border: 1px solid #5b4936; }
.lang-short { display: none; }
.sidebar-meta { display: flex; align-items: center; justify-content: space-between; min-height: 35px; padding: 8px 1px 0 7px; gap: 4px; }
.version { color: #b1a290; font-size: .76rem; }
.sidebar-meta .exit-button { width: 32px; height: 32px; min-height: 32px; color: var(--muted); }

.workspace {
  position: fixed; inset: 0 0 0 var(--nav-width); overflow: auto; overscroll-behavior: contain;
  background: radial-gradient(80% 70% at 65% 5%,#201b18 0%,transparent 70%), var(--canvas);
}
.content { max-width: 1440px; padding: clamp(20px,3.2vw,48px); margin: 0 auto; min-height: 100%; }
.page-header { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.page-header h1 {
  color: #f0d9ba; font: 600 clamp(2rem,4vw,3.2rem)/1.05 var(--serif); letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.page-header p { max-width: 64ch; margin-top: .62rem; color: var(--muted); }

.hero {
  position: relative; isolation: isolate; min-height: clamp(250px, 31vw, 367px); display: flex;
  flex-direction: column; justify-content: center; gap: 20px; overflow: hidden;
  padding: clamp(25px,5vw,67px); border: 1px solid #6b5238; border-radius: 15px;
  background: linear-gradient(90deg,#151413f2 0%,#161412e8 24%,#1614129e 53%,#16141237 80%,#16141229 100%),
    linear-gradient(0deg,#110c0bd6,transparent 40%), url('./assets/neutral.webp') center 51% / cover, #211914;
}
.hero-edge { position: absolute; inline-size: 38px; block-size: 38px; border-color: #bd9568; border-style: solid; opacity: .73; pointer-events: none; }
.top-edge { inset: 12px auto auto 12px; border-width: 1px 0 0 1px; }
.bottom-edge { inset: auto 12px 12px auto; border-width: 0 1px 1px 0; }
.hero-inner { position: relative; width: min(100%, 620px); }
.hero h1 { display: grid; justify-items: start; color: #f4d7ac; line-height: 1; text-wrap: balance; }
.hero-name { font: 600 clamp(3rem,7vw,6.25rem)/.88 var(--serif); letter-spacing: -.074em; text-transform: uppercase; }
.hero-book { color: #ebd1ad; font: 700 clamp(.87rem,1.9vw,1.34rem)/1.3 var(--sans); margin-top: .83rem; letter-spacing: .23em; text-transform: uppercase; }
.hero-subtitle { color: #f0e3d1; margin-top: 1rem; font-size: clamp(.96rem,1.45vw,1.16rem); }
.hero-ic { color: #d7bda3; margin-top: .45rem; font-size: .85rem; max-width: 37ch; }
.hero-credit { display: flex; flex-wrap: wrap; gap: 3px 11px; color: #e0c5a6; font-size: .78rem; line-height: 1.3; }
.hero-credit span { padding-inline-start: 11px; border-inline-start: 1px solid #b78b64; }

.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: clamp(8px,1.25vw,16px); margin-top: 18px; }
.metric {
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: clamp(6px,1.1vw,13px);
  text-align: left; min-width: 0; min-height: 88px; padding: clamp(10px,1.6vw,20px);
  border-radius: var(--radius); background: #24201c; border: 1px solid #574737; color: #f3d1a7;
}
.metric.clear { background: #1e2821; border-color: #49654e; color: var(--green); }
.metric.pending { background: #34281d; border-color: #86613e; color: var(--amber); }
.metric:hover { filter: brightness(1.12); }
.metric-symbol { display: grid; place-items: center; width: clamp(31px,3.4vw,47px); aspect-ratio: 1; border-radius: 8px; background: #eecea210; border: 1px solid #eecea236; }
.metric.clear .metric-symbol { background: #beddb216; border-color: #beddb244; }
.metric-symbol .icon { width: 1.25rem; height: 1.25rem; }
.metric-text { display: grid; gap: 3px; line-height: 1.2; }
.metric-text strong { font: 600 clamp(1.65rem,2.8vw,2.5rem)/.85 var(--serif); font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; }
.metric-text span { color: #e4dace; font-size: .89rem; overflow-wrap: anywhere; }
.metric > .icon { width: .85rem; }
.home-actions { padding: 23px 0 14px; }
.home-actions .big-add { min-height: 48px; padding: .8rem 1.3rem; font-size: .99rem; }

.search-tools { border-radius: var(--radius); background: #1b1b1e; border: 1px solid var(--line); overflow: clip; }
.search-line { min-width: 0; display: flex; gap: 13px; flex-wrap: wrap; align-items: end; padding: 13px; }
.search-line > .field { min-width: min(100%,190px); max-width: min(100%,350px); }
.search-box { position: relative; flex: 1 1 260px; min-width: 0; display: flex; align-items: center; }
.search-box > .icon { position: absolute; left: 12px; color: #c0a987; }
.search-box .search-input { width: 100%; padding-inline: 37px 46px; min-height: 44px; }
.search-input::-webkit-search-cancel-button { appearance:none; }
.search-box > .icon-button { position: absolute; right: 4px; color: var(--muted); }
input[type=text], input[type=search], select, textarea {
  display: block; width: 100%; padding: .63rem .71rem; border: 1px solid #514841;
  border-radius: 8px; background: var(--field); color: #fff2e1; min-width: 0; min-height: 40px;
}
input::placeholder, textarea::placeholder { color: #a89e93; opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: #d8ab77; }
textarea { resize: vertical; line-height: 1.5; max-height: 70vh; min-height: 94px; }
.field { display: grid; gap: 6px; min-width: 0; text-align: left; align-content: start; }
.field-label { font-size: .91rem; font-weight: 700; color: #eaded0; overflow-wrap: anywhere; }
.field-help { color: var(--muted); font-size: .81rem; line-height: 1.4; }
.advanced > summary, .multi-filter > summary {
  display: flex; align-items: center; gap: 9px; line-height: 1.3;
  list-style: none; cursor: pointer; color: #e3c39e;
}
.advanced > summary::-webkit-details-marker, .multi-filter > summary::-webkit-details-marker { display: none; }
.advanced > summary { border-top: 1px solid #343134; padding: 11px 15px; font-size: .89rem; font-weight: 700; }
.advanced > summary:hover, .multi-filter > summary:hover { background: #262322; }
.advanced > summary > .icon:last-child, .multi-filter > summary > .icon { margin-inline-start: auto; width: .9rem; height: .9rem; }
.advanced[open] > summary > .icon:last-child, .multi-filter[open] > summary > .icon { transform: rotate(180deg); }
.filter-count { border-radius: 5px; background: #483627; padding: 2px 7px; color: #f4c68d; font-size: .77rem; }
.filters-body { display: grid; gap: 13px; padding: 3px 14px 13px; }
.filter-grid, .multi-grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit,minmax(min(100%,145px),1fr)); }
.multi-grid { grid-template-columns: repeat(3,minmax(0,1fr)); align-items: start; }
.multi-filter { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #17181a; overflow: clip; }
.multi-filter > summary { padding: 9px; flex-wrap: wrap; font-size: .86rem; }
.selected-value { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.multi-content { padding: 6px 9px 9px; border-top: 1px solid var(--line-soft); display: grid; gap: 4px; max-height: 240px; overflow: auto; }
.filter-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; }
.filter-footer .button { margin-inline-start: auto; font-size: .83rem; }
.check { display: flex; align-items: start; gap: 8px; min-width: 0; color: #e6dbce; line-height: 1.42; font-size: .91rem; cursor: pointer; }
.check span { min-width: 0; overflow-wrap: anywhere; }
.check input { margin: .15rem 0 0; inline-size: 1.02rem; block-size: 1.02rem; accent-color: #e2b783; flex: 0 0 auto; }

.results:empty { display: none; }
.results-heading { margin: 17px 1px 9px; color: #ccbdad; font-size: .87rem; font-weight: 600; }
.table-scroll {
  max-height: min(64vh,650px); overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: var(--radius); outline-offset: 2px; background: var(--surface);
}
.table-short { max-height: min(47vh,460px); }
.contact-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; text-align: left; }
.contact-table th, .contact-table td { padding: .52rem clamp(5px,1vw,14px); overflow-wrap: anywhere; }
.contact-table th { position: sticky; z-index: 1; top: 0; background: #242120; border-bottom: 1px solid #5e4b38; }
.contact-table td { color: #e0d5c9; font-size: .91rem; border-bottom: 1px solid #313033; line-height: 1.35; }
.contact-table tr { cursor: pointer; }
.contact-table tr:hover td, .contact-table tr:focus-within td { background: #292421; }
.contact-table tr:last-child td { border-bottom: none; }
.contact-table th { white-space: normal; }
.contact-table .column-sort { justify-content: start; min-height: 32px; padding: 0 2px; text-align: left; font-size: .86rem; flex-wrap: wrap; gap: 3px 5px; }
.contact-table .column-sort.active, .contact-table .column-sort.active > .icon { color: #f3bd80; }
.contact-table .column-sort > .icon { width: .72rem; height: .72rem; color: #baab9b; }
.contact-table .col-first, .contact-table .col-last { width: 17%; }
.contact-table .col-village, .contact-table .col-rank { width: 20%; }
.contact-table .col-division { width: 26%; }

.empty-state { border: 1px solid var(--line); border-radius: var(--radius); display: grid; justify-items: center; gap: 10px; padding: 34px 17px; min-width: 0; text-align: center; background: #1a1a1c; }
.empty-symbol, .utility-symbol { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 9px; background: #362b20; border: 1px solid #624d37; color: var(--gold); }
.empty-title { font-size: 1.02rem; color: #ecdac5; font-weight: 600; }
.empty-detail { color: var(--muted); max-width: 54ch; }
.concern-results { display: grid; gap: 11px; max-height: min(66vh,720px); overflow: auto; overscroll-behavior: contain; }
.concern-card,.task-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.concern-card { padding: 13px 17px; }
.concern-card > header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 13px; }
.concern-card .concern-name { font-size: 1.06rem; min-height: auto; }
.concern-text { margin: .7rem 0 .45rem; }
.concern-card > .button { padding-inline-start: 0; }
.task-tools { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 15px; }
.task-tools .check { min-height: 40px; align-items: center; }
.task-tools .field { min-width: min(100%,185px); }
.task-list, .admin-list, .backup-counts { list-style: none; padding: 0; }
.task-list { display: grid; gap: 9px; }
.task-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 14px; align-items: start; padding: 12px 15px; }
.task-row .task-check { width: 30px; min-height: 30px; padding: 0; margin-top: 3px; }
.task-copy p { font-size: .99rem; margin: 4px 0 6px; }
.task-done .task-copy p { color: var(--muted); text-decoration: line-through; }
.status-done { display: inline-block; color: #bfdfbd; margin-left: 10px; font-size: .85rem; }

.admin-nav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.admin-nav .category { border-color: var(--line); background: var(--surface); }
.admin-nav .category.active { border-color: #9d754d; color: #f3c38b; background: #30251d; }
.maintenance-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.maintenance-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.maintenance-header h2, .backup-card h2 { color: #eed3b1; font: 600 1.53rem/1.11 var(--serif); letter-spacing: -.012em; }
.maintenance-header p { margin-top: 3px; color: var(--muted); font-size: .87rem; }
.maintenance-filter { padding: 12px 17px; border-bottom: 1px solid var(--line); }
.maintenance-filter .field { max-width: 400px; }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 7px 14px; min-width: 0; border-bottom: 1px solid var(--line-soft); }
.admin-row:last-child { border-bottom: none; }
.entry-name { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.entry-name .subtle { font-size: .84rem; }
.rank-number { width: 24px; text-align: right; color: var(--gold); font-size: .83rem; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.row-actions .button { font-size: .83rem; min-height: 33px; }
.row-actions .icon-button { width: 31px; height: 31px; padding: 0; }

.backup-grid { display: grid; gap: 16px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.backup-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.backup-card h2 { margin-top: 11px; }
.backup-card > p { margin: 8px 0 14px; color: var(--muted); }
.backup-card .backup-status { display: grid; gap: 9px; margin-bottom: 14px; }
.backup-status dt { font-size: .79rem; color: var(--muted); margin-bottom: 3px; }
.backup-status dd { margin: 0; overflow-wrap: anywhere; }
.backup-status .disk-path { font-family: ui-monospace, monospace; font-size: .78rem; color: #e1d2bf; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.backup-due { display: flex; align-items: center; gap: 8px; color: #f1bf87; border: 1px solid #785635; border-radius: 9px; background: #32261c; margin-bottom: 14px; padding: 9px 12px; }
.backup-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.backup-counts li { padding: 4px 7px; border: 1px solid #66503a; background: #2b241e; color: #f0d2ac; border-radius: 6px; }

.layer {
  position: fixed; z-index: 5; inset: 0 0 0 var(--nav-width); padding: clamp(8px,2vw,24px);
  display: grid; place-items: center; background: #0d0d10bd; overflow: hidden;
}
.layer:not(.layer-top) { pointer-events: none; }
.layer ~ .layer { background: #080809ac; }
.dialog {
  display: flex; flex-direction: column; width: min(100%,790px); max-height: 100%;
  min-width: 0; min-height: 0; border-radius: 14px; border: 1px solid #766047; overflow: hidden;
  background: #1c1c1f; box-shadow: 0 23px 94px #000a;
}
.dialog.confirm-dialog { width: min(100%,550px); }
.dialog.character-dialog { width: min(100%,860px); }
.dialog-header,.dialog-footer { display: flex; gap: 8px; padding: 10px 15px; align-items: center; background: #232121; min-width: 0; }
.dialog-header { justify-content: space-between; border-bottom: 1px solid #47403a; }
.dialog-header h2 { font: 600 clamp(1.24rem,2.6vw,1.78rem)/1.13 var(--serif); color: #f0d6b4; overflow-wrap: anywhere; }
.dialog-header .icon-button { color: #e0ccb5; flex: 0 0 auto; }
.dialog-footer { justify-content: end; flex-wrap: wrap; border-top: 1px solid #46403a; }
.dialog-footer > .button:first-child { margin-inline-end: auto; }
.dialog-body { overflow: auto; min-height: 0; overscroll-behavior: contain; }
.dialog-body > .form-stack,.editor-fields { padding: 15px; }
.form-tabs { display: flex; flex-wrap: wrap; padding-inline: 12px; gap: 0 4px; border-bottom: 1px solid #494039; }
.form-tabs button {
  flex: 0 1 auto; min-width: 0; min-height: 42px; padding: 6px 9px; background: transparent; border: 0; border-bottom: 2px solid transparent;
  text-align: center; color: var(--muted); font-weight: 700; overflow-wrap: anywhere; font-size: .91rem;
}
.form-tabs button:hover { background: #2a2623; }
.form-tabs button[aria-selected=true] { color: #f4cb9a; border-bottom-color: #e8b47d; }
.form-grid,.profile-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 15px; }
.form-stack { display: grid; gap: 12px; min-width: 0; }
.form-stack > .button { justify-self: start; }
.field-error { background: #3b2625; border: 1px solid #a76d64; color: #ffdbd2; padding: 8px 10px; border-radius: 8px; font-size: .9rem; }
.editor-fields > .field-error { margin-bottom: 11px; }
.choice-block { min-width: 0; margin: 0; padding: 11px; border: 1px solid #49423a; border-radius: 9px; }
.choice-block legend { font-weight: 700; padding: 0 5px; color: #eed4b5; }
.choice-block > .check + .check { margin-top: 7px; }
.choice-list { display: flex; gap: 8px 14px; flex-wrap: wrap; }
.division-block > .field-help { margin-top: 9px; }
.division-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 9px; margin-top: 12px; }
.division-choice { min-width: 0; padding: 8px; background: #16171a; border: 1px solid var(--line); border-radius: 7px; }
.division-choice > .field { margin-top: 7px; }
.division-choice .field-label { font-size: .78rem; color: var(--muted); }
.division-choice select { min-height: 31px; padding: 4px 6px; font-size: .9rem; }
.mapping-list { display: grid; gap: 8px; }
.duplicate-match { display: grid; gap: 4px; border-radius: 8px; padding: 9px; border: 1px solid var(--line); overflow-wrap: anywhere; }
.duplicate-match .button { justify-self: start; }
.impact { border-left: 2px solid #d1a46f; padding-left: 9px; color: #f0d3af; }
.profile-hero {
  --village-image: url('./assets/neutral.webp');
  display: flex; align-items: center; gap: 13px; padding: 26px 18px; min-height: 151px;
  background: linear-gradient(90deg,#141414ed,#141414b8 35%,#14141423 78%),var(--village-image) center 49%/cover,#2a2118;
  border-bottom: 1px solid #62513b;
}
.profile-hero.theme-konoha { --village-image: url('./assets/konoha.webp'); }
.profile-hero.theme-suna { --village-image: url('./assets/suna.webp'); }
.profile-hero.theme-ame { --village-image: url('./assets/ame.webp'); }
.profile-hero.theme-kiri { --village-image: url('./assets/kiri.webp'); }
.profile-hero h3 { font: 600 clamp(1.64rem,4vw,2.75rem)/1.05 var(--serif); text-shadow: 0 2px 6px #0c0b0a; overflow-wrap: anywhere; }
.profile-hero > div { min-width: 0; }
.profile-village { color: #f4d5ae; font-weight: 700; font-size: .81rem; overflow-wrap: anywhere; }
.crest { display: grid; width: 56px; height: 42px; border: 1px solid #b78f63; border-radius: 7px; place-items: center; background: #3e3126; color: #f1cf9d; box-shadow: inset 0 1px 2px #e1b7844d; flex: 0 0 auto; }
.crest-icon { width: 29px; height: 29px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.profile-content { display: grid; gap: 13px; padding: 13px 15px 20px; }
.profile-points { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,128px),1fr)); gap: 8px; }
.profile-points dl { padding: 8px; border-radius: 7px; border: 1px solid #453d35; background: #24201d; }
.profile-section { border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: #19191c; }
.profile-section h3 { color: #eed2ac; font: 600 1.22rem/1.1 var(--serif); margin-bottom: 11px; }
.property dt { color: #c4b5a5; font: 600 .8rem/1.3 var(--sans); margin-bottom: 4px; overflow-wrap: anywhere; }
.property dd { font-size: .95rem; color: #f3e8da; line-height: 1.45; margin: 0; overflow-wrap: anywhere; }
.profile-divisions { display: grid; padding: 0; list-style: none; gap: 4px; }
.profile-divisions li { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
.profile-divisions li span { color: #c4b5a5; font-size: .86rem; }

.notices { position: fixed; z-index: 15; inset: auto 15px 15px calc(var(--nav-width) + 12px); display: grid; justify-items: end; gap: 8px; pointer-events: none; }
.notice {
  display: flex; align-items: center; gap: 9px; width: max-content; max-width: min(100%,520px); padding: 7px 9px 7px 13px;
  background: #253427; border: 1px solid #6a8869; border-radius: 9px; color: #e0eddd;
  box-shadow: 0 8px 20px #0008; pointer-events: none; overflow-wrap: anywhere;
}
.notice-error { color: #f7dbd1; background: #3a2925; border-color: #b48373; }
.notice .icon-button { pointer-events: auto; width: 29px; height: 29px; min-height: 29px; flex: 0 0 auto; }

@media (max-width: 1050px) {
  :root { --nav-width: 183px; }
  .sidebar { padding-inline: 9px; }
  .sidebar .nav-link { padding-inline: 8px; gap: 8px; font-size: .89rem; }
  .hero { min-height: 260px; }
  .metric > .icon { display: none; }
  .metric { grid-template-columns: auto minmax(0,1fr); }
  .contact-table .column-sort { min-height: 25px; }
}

@media (max-width: 760px) {
  :root { --nav-width: 60px; }
  .sidebar { padding: 11px 6px 8px; }
  .sidebar .wordmark { min-height: 41px; padding: 3px; margin-bottom: 14px; justify-content: center; }
  .wordmark-type, .nav-label, .lang-full { display: none; }
  .brand-mark { width: 35px; height: 35px; }
  .brand-mark .icon { width: 21px; height: 21px; }
  .sidebar .nav-link { min-height: 41px; justify-content: center; padding: 5px; }
  .nav-backup-due { position: absolute; top: 5px; right: 5px; }
  .language-control { grid-template-columns: 1fr; padding: 2px; }
  .language-control .lang { min-height: 28px; }
  .lang-short { display: inline; }
  .sidebar-meta { flex-direction: column; padding-inline: 0; }
  .version { text-align: center; font-size: .64rem; }
  .content { padding: 17px 12px; }
  .hero { min-height: 255px; padding: 26px 19px; }
  .metric-text span { font-size: .8rem; }
  .backup-grid { grid-template-columns: 1fr; }
  .contact-table th, .contact-table td { font-size: .81rem; padding: .38rem 5px; }
  .contact-table .column-sort { font-size: .78rem; }
  .dialog-footer { padding-inline: 9px; }
}
@media (max-width: 530px) {
  .metrics { gap: 5px; }
  .metric { grid-template-columns: minmax(0,1fr); gap: 6px; min-height: 84px; padding: 7px 6px; align-content: center; }
  .metric-symbol { width: 25px; border-radius: 5px; }
  .metric-symbol .icon { width: .95rem; height: .95rem; }
  .metric-text strong { font-size: 1.37rem; }
  .metric-text span { font-size: .72rem; }
  .multi-grid, .form-grid, .division-choices { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: auto minmax(0,1fr); }
  .task-row .row-actions { grid-column: 2; }
  .admin-row { flex-wrap: wrap; }
  .admin-row .row-actions { min-width: max-content; }
  .contact-table .column-sort { gap: 1px 3px; }
  .hero-credit span { border: 0; padding: 0; }
  .dialog-footer > .button:first-child { margin-inline-end: 0; }
  .dialog-body > .form-stack,.editor-fields { padding: 10px; }
}
@media (max-height: 510px) {
  .sidebar { padding-block: 7px; }
  .sidebar .wordmark { margin-bottom: 8px; min-height: 40px; }
  .nav-items { gap: 2px; }
  .sidebar .nav-link { min-height: 35px; }
  .sidebar-foot { padding-top: 9px; }
  .hero { min-height: 220px; }
}
