:root {
  font: 16px/1.5 Inter, "Segoe UI", system-ui, sans-serif;
  color: #211c2d;
  background: #f8f6fa;
  --purple: #783381;
  --nav: #25182e;
  --line: #e4ddea;
  --muted: #596277;
  --focus: #8b4d9a;
  --radius: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input, select, textarea { font: inherit; }
button, a, summary { touch-action: manipulation; }
button {
  display: inline-block;
  min-inline-size: min-content;
  padding: .52rem .85rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #3c2447;
  cursor: pointer;
  font-weight: 650;
}
button:hover { border-color: #a077ad; background: #f7eef9; }
button.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
button.primary:hover { background: #65266e; border-color: #65266e; }
button:disabled { opacity: .55; cursor: default; }
a { color: var(--purple); text-underline-offset: .15em; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.035em; }
h2 { font-size: 1.23rem; }
h3 { font-size: 1rem; }
p { margin: .6rem 0; }
small, .muted { color: var(--muted); }
.eyebrow { color: #755081; font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #70557b var(--nav);
  padding: 1.4rem 1rem 1rem;
  background: var(--nav);
  color: #f4ebf7;
}
.sidebar-brand { display: flex; align-items: center; margin-bottom: 1.3rem; }
.sidebar .brand-home { padding: .25rem; border: 0; border-radius: 8px; background: transparent; }
.sidebar .kifoto-logo { width: 130px; }
.sidebar-navigation, .nav-group { display: grid; gap: .25rem; }
.sidebar-navigation { gap: 1.12rem; }
.nav-title { display: block; padding: .12rem .65rem; color: #d0b9d9; font-size: .73rem; font-weight: 750; }
.sidebar-navigation button, .mobile-shortcuts button {
  width: 100%;
  min-width: 0;
  text-align: left;
  color: #f2eaf5;
  background: transparent;
  border: 1px solid transparent;
  font-size: .91rem;
}
.sidebar-navigation button:hover, .mobile-shortcuts button:hover { background: #3f2a4b; border-color: transparent; }
.sidebar [aria-current="page"], .sidebar #menu-toggle[aria-expanded="true"] { background: #52325f; color: #fff; border-color: #785585; }
.sidebar :focus-visible { outline-color: #e8b9f6; }
.sidebar footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 1.5rem; padding: .8rem .15rem 0; border-top: 1px solid #563e60; font-size: .78rem; color: #dbcde2; }
.sidebar footer button { border-color: #6c5476; color: #fff; background: transparent; }
.sidebar footer button:hover { background: #42304a; }
.mobile-shortcuts { display: none; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 8; transform: translateY(-200%); background: #fff; padding: .65rem 1rem; border-radius: 8px; }
.skip-link:focus { transform: none; }
main { padding: clamp(18px, 3vw, 42px); max-width: 1530px; width: 100%; min-width: 0; }
main:focus { outline: none; }
.top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .9rem 1.25rem; margin-bottom: clamp(18px, 3vw, 30px); }
.top > div:first-child { flex: 1 1 16rem; min-width: 0; }
.top p { margin-bottom: 0; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.card { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(.95rem, 2vw, 1.4rem); box-shadow: 0 1px 3px #2b143209; }
.card h2 { margin-bottom: .85rem; }
.card h3 { margin: .75rem 0 .45rem; }
.card + .card { margin-top: 1rem; }
.columns, .detail-grid, .facts, .formgrid, .stats { display: grid; gap: 1rem; min-width: 0; }
.columns { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.columns > .card + .card { margin-top: 0; }
.detail-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.detail-grid > div, .detail-grid > section { min-width: 0; }
.detail-grid > div > * + * { margin-top: 1rem; }
.facts, .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts small { display: block; margin-bottom: .15rem; }
.wide { grid-column: 1 / -1; }
.stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.stat strong { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; background: #f2e7f5; color: #64316e; border-radius: 100px; padding: .22rem .62rem; width: fit-content; font-size: .83rem; font-weight: 700; }
.notice { border: 1px solid #d9c4e0; background: #f6eef8; border-radius: 10px; padding: .72rem .95rem; margin: 0 0 1rem; color: #56395e; }
.row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .85rem 0; border-bottom: 1px solid #eee8f1; min-width: 0; }
.row:last-child { border-bottom: 0; }
.row > * { min-width: 0; }
.row p { margin: .25rem 0; }
.row button { text-align: left; }
.flat { border: 0; padding: .3rem 0; background: transparent; }
.actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin: .85rem 0; }
.actions:last-child { margin-bottom: 0; }
form > label + label { margin-top: .75rem; }
label { display: grid; gap: .3rem; min-width: 0; font-size: .9rem; font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; padding: .55rem .7rem; border: 1px solid #d2c6d8; border-radius: 8px; background: #fff; color: #211c2d; }
textarea { min-height: 6.25rem; resize: vertical; }
fieldset { min-width: 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: .85rem 0; }
.check input { accent-color: var(--purple); width: 1.1rem; height: 1.1rem; margin: .12rem 0 0; flex: 0 0 auto; }
.hint { font-size: .86rem; font-weight: 400; color: var(--muted); }
.search { max-width: 28rem; margin-bottom: 1.1rem; }
.empty { text-align: center; padding: 1.7rem .5rem; color: var(--muted); }
.price { margin: .65rem 0; font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.timeline { margin: .75rem 0; padding-left: .8rem; border-left: 2px solid #dcc7e6; }
.timeline p { font-size: .92rem; margin-bottom: 1rem; }
.timeline small { display: block; }
.pre { white-space: pre-wrap; line-height: 1.65; overflow-x: auto; }
.step { padding: .85rem; border: 1px solid #e8dded; border-radius: 10px; background: #f8f4fa; margin: .7rem 0; }
.tablewrap { max-width: 100%; overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
td, th { padding: .62rem .72rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: top; }
th { color: #574660; font-weight: 700; }
summary { cursor: pointer; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); width: 42rem; max-width: calc(100vw - 20px); max-height: 90vh; max-height: 90dvh; padding: clamp(.95rem, 3vw, 1.7rem); overflow: auto; color: inherit; box-shadow: 0 22px 80px #21122d44; }
dialog::backdrop { background: #21122db0; }
dialog h2 { margin: 0 0 .9rem; }
.login { width: min(calc(100% - 32px), 26rem); margin: clamp(2rem, 10vh, 6rem) auto; padding: clamp(1.2rem, 6vw, 2.25rem); }
.login h1 { margin: .6rem 0 1.3rem; }
.portal { max-width: 60rem; margin: 1.7rem auto; padding: 0 clamp(.65rem, 3vw, 1.4rem); }
.portal header { display: flex; justify-content: space-between; }
.portal .card { margin-top: 1rem; }
#toast { position: fixed; z-index: 8; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: none; max-width: min(90vw, 33rem); padding: .75rem 1rem; border-radius: 10px; background: #24162e; color: #fff; overflow-x: auto; }

@media (max-width: 64rem) {
  .layout { grid-template-columns: 12rem minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 52rem) {
  .layout { display: block; }
  .sidebar { position: relative; height: auto; overflow: visible; padding: .6rem .8rem; }
  .sidebar-brand { margin: 0 0 .45rem; }
  .sidebar .kifoto-logo { width: 91px; }
  .mobile-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .27rem; }
  .mobile-shortcuts button { text-align: center; padding: .4rem .1rem; font-size: clamp(.7rem, 2.4vw, .9rem); }
  .navigation-panel { display: none; padding: .9rem 0 .3rem; }
  .menu-open .navigation-panel { display: block; }
  .sidebar-navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem .6rem; align-items: start; }
  .sidebar-navigation button { padding: .55rem .6rem; }
  .sidebar footer { margin-top: .85rem; }
}
@media (max-width: 42rem) {
  main { padding: 1rem .8rem 1.5rem; }
  .columns, .facts, .formgrid { grid-template-columns: minmax(0, 1fr); }
  .card .top { margin-bottom: .6rem; }
  .row { flex-wrap: wrap; gap: .5rem .75rem; }
  button, .file-button { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  input[type="date"], input[type="time"] { max-width: 100%; }
  dialog { margin-inline: auto; }
}
@media print {
  .sidebar, .actions, .notice, button, .check, #toast { display: none !important; }
  .layout, .detail-grid { display: block; }
  main, .portal { margin: 0; padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; background: white; }
  .pre { font-size: 11pt; }
}
