:root {
  font: 16px/1.45 system-ui, -apple-system, sans-serif;
  color: #191b2b;
  background: #f5f5f9;
  --accent: #4640ab;
  --muted: #656579;
  --line: #dedfea;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
:focus-visible { outline: 3px solid #9873e9; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.sign-in { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card, dialog {
  background: white; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 12px 40px #24223c14;
}
.login-card { width: min(100%, 420px); padding: 30px; }
.login-card h1 { margin: 18px 0 22px; font-size: 27px; }
.login-card .primary { width: 100%; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; background: var(--accent); color: white; font-weight: 720; font-size: 22px;
}
form label { display: block; margin: 15px 0 6px; font-weight: 610; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #c8cadb;
  border-radius: 8px; color: inherit; background: white;
}
textarea { resize: vertical; }
.primary {
  display: inline-block; border: 0; border-radius: 9px; padding: 11px 17px;
  background: var(--accent); color: white; font-weight: 650;
}
.primary:hover { background: #392f8e; }
form .primary { margin-top: 16px; }
.quiet { background: transparent; border: 0; color: var(--accent); padding: 8px 10px; font-weight: 610; }
.workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100dvh; }
.rail {
  background: white; border-right: 1px solid var(--line); padding: 23px 17px;
  display: flex; flex-direction: column; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.2; }
.brand strong { font-size: 19px; }
nav { display: grid; gap: 5px; }
.nav-button {
  border: 0; border-radius: 8px; text-align: left; background: transparent;
  padding: 10px 12px; color: #35364b; font-weight: 610;
}
.nav-button[aria-current="page"] { color: #3b3197; background: #eeecff; }
.account { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
main { width: min(100%, 1080px); padding: 42px 5vw; }
.page-header { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 24px; }
.page-header h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.2; margin-bottom: 8px; letter-spacing: -.025em; }
.page-header p, .empty p { color: var(--muted); }
.notice { color: #882a3c; margin-top: 10px; white-space: pre-wrap; }
.notice:empty { display: none; }
.item-list, .history { padding: 0; list-style: none; margin: 18px 0 0; }
.item-list li + li { margin-top: 9px; }
.item {
  background: white; border: 1px solid var(--line); border-radius: 11px;
  padding: 15px 17px; width: 100%; display: flex; justify-content: space-between;
  align-items: center; gap: 14px; text-align: left;
}
.item:hover { border-color: #938acb; }
.item-title { font-weight: 650; overflow-wrap: anywhere; }
.item-date, .history time { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.statement-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.statement-form label, .statement-form .primary { margin: 0; }
.statement-form input { min-width: 135px; }
.payment { background: white; border: 1px solid var(--line); border-radius: 11px; padding: 15px 17px; }
.payment-heading { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.payment-amount { font-variant-numeric: tabular-nums; }
.payment-description { margin-top: 7px; overflow-wrap: anywhere; white-space: pre-wrap; }
.status {
  display: inline-block; border-radius: 6px; padding: 4px 8px; color: #55546a;
  background: #eeedf5; font-size: 13px; white-space: nowrap;
}
.status[data-state="review"] { color: #664906; background: #fff2c9; }
.status[data-state="done"] { color: #236047; background: #dff7e9; }
.empty { border: 1px dashed #c4c3d8; border-radius: 14px; padding: 38px 25px; text-align: center; background: #fafaff; }
.empty h2 { font-size: 20px; margin-bottom: 5px; }
dialog { width: min(620px, calc(100% - 24px)); padding: 22px 24px; max-height: 90dvh; }
dialog::backdrop { background: #1a183887; }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-header h2 { font-size: 24px; overflow-wrap: anywhere; }
.description, .history p { white-space: pre-wrap; overflow-wrap: anywhere; }
.description { margin: 10px 0 16px; }
#item-detail h3 { margin-top: 24px; }
.history li { padding: 10px 0; border-top: 1px solid var(--line); }
.history p { margin-top: 4px; }
@media (max-width: 720px) {
  .workspace { display: block; }
  .rail { display: grid; grid-template-columns: 1fr auto; gap: 13px; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 16px 0; }
  .account { grid-column: 2; grid-row: 1; margin: 0; gap: 5px; }
  nav { display: flex; flex-wrap: wrap; grid-column: 1 / -1; padding-bottom: 9px; }
  main { padding: 24px 16px; }
  .page-header { flex-wrap: wrap; gap: 12px; }
}


.mail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.mail-panel {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 18px;
  padding: 1rem;
}
.mail-panel h2 { margin-top: 0; }
.mail-form { display: grid; gap: .75rem; }
.mail-form label { display: grid; gap: .35rem; }
.mail-form input, .mail-form textarea { width: 100%; box-sizing: border-box; }
.mail-inbox-panel { margin-top: 1rem; }
@media (max-width: 900px) {
  .mail-grid { grid-template-columns: 1fr; }
}
