/* Shared foundation, then one complete profile per viewport.
   Edit the relevant rule in place; do not append overlapping override sections. */
:root {
  font-family: Arial,"Malgun Gothic",sans-serif;
  color: #22251f;
  background: #f3f2ee;
  font-size: 15px;
  line-height: 1.5;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none!important;
}
body {
  margin: 0;
}
button,input,select,textarea {
  font: inherit;
  color: inherit;
}
button,a,input,select,textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  background: white;
  border: 1px solid #c7cbc2;
  border-radius: 5px;
  padding: 8px 12px;
}
button:hover {
  background: #edf2e9;
}
button:disabled {
  opacity: .55;
  cursor: wait;
}
a {
  color: #28553c;
}
input,select,textarea {
  background: white;
  border: 1px solid #aeb6a9;
  border-radius: 4px;
  padding: 9px;
  width: 100%;
  min-width: 0;
}
textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
label input,label select,label textarea {
  display: block;
  margin-top: 5px;
  font-weight: 400;
}
:focus-visible {
  outline: 3px solid #487c63;
  outline-offset: 2px;
}
header {
  border-bottom: 1px solid #d1d5cb;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.brand {
  font-size: 24px;
  font-weight: 800;
  color: #22251f;
  text-decoration: none;
  letter-spacing: -1.5px;
}
header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  font-size: 13px;
}
#message {
  margin: 0;
  padding: 0 24px;
  white-space: pre-wrap;
}

/* Desktop layout: independent scrolling panes. */
@media (width > 850px) {
  #message:not(:empty) {
    background: #fff4d8;
    border-bottom: 1px solid #e2d5ae;
  }
  .login {
    max-width: 400px;
    margin: 70px auto;
    padding: 24px;
  }
  .login button {
    margin-top: 20px;
    width: 100%;
  }
  #tabs {
    display: flex;
    border-bottom: 1px solid #d1d5cb;
  }
  #tabs button {
    min-width: 85px;
  }
  #tabs button[aria-current=true],.primary {
    background: #274b37;
    color: white;
    border-color: #274b37;
  }
  .layout {
    display: grid;
    grid-template-columns: 300px minmax(0,1fr);
  }
  aside {
    border-right: 1px solid #d1d5cb;
    background: #edeee8;
  }
  .actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 12px 0;
  }
  .side-list {
    display: grid;
    gap: 6px;
  }
  .side-list button {
    text-align: left;
    overflow-wrap: anywhere;
  }
  .side-list button small {
    display: block;
    color: #596553;
    font-weight: 400;
  }
  .side-list button.selected {
    border-color: #274b37;
    background: #dce8d7;
    font-weight: 700;
  }
  .side-title {
    font-size: 12px;
    color: #56604e;
    margin: 22px 0 8px;
  }
  .muted,.hint {
    color: #66705f;
    font-size: 13px;
  }
  .hint {
    margin: 8px 0;
  }
  .memo {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 260px;
    overflow: auto;
    background: #fffef6;
    border: 1px solid #e1dfcd;
    padding: 14px;
    border-radius: 5px;
  }
  .memo:empty::before {
    content: '메모 없음';
    color: #75786c;
  }
  #content {
    min-width: 0;
  }
  .heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 24px;
    margin: 0;
    overflow-wrap: anywhere;
  }
  h2 {
    font-size: 19px;
    margin: 12px 0;
  }
  h3 {
    font-size: 16px;
  }
  p {
    overflow-wrap: anywhere;
  }
  .table-wrap {
    overflow: auto;
    background: white;
    border: 1px solid #d2d6cc;
    border-radius: 5px;
    margin-top: 14px;
  }
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
  }
  th,td {
    padding: 11px 12px;
    border-bottom: 1px solid #e5e8e0;
    text-align: left;
    vertical-align: top;
  }
  th {
    white-space: nowrap;
    font-size: 12px;
    background: #e9ede4;
  }
  td {
    min-width: 90px;
  }
  .amount {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  td.note {
    white-space: pre-wrap;
    min-width: 180px;
    max-width: 360px;
    overflow-wrap: anywhere;
  }
  td.name {
    min-width: 170px;
  }
  .link-button {
    background: none;
    border: 0;
    padding: 0;
    color: #28553c;
    text-align: left;
    text-decoration: underline;
  }
  .row-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
  }
  .row-actions button {
    font-size: 12px;
    padding: 5px 8px;
  }
  .check {
    min-width: 36px;
    width: 36px;
  }
  .check input {
    width: 18px;
    height: 18px;
    margin: 0;
  }
  .empty {
    padding: 35px 0;
    color: #66705f;
  }
  .comparison {
    background: #e7eee2;
    padding: 16px;
    margin-top: 18px;
    border-radius: 6px;
  }
  .comparison h2 {
    margin-top: 0;
  }
  .stars {
    display: inline-block;
    position: relative;
    color: #bfc6b6;
    white-space: nowrap;
    font-size: 20px;
    letter-spacing: 1px;
    line-height: 1.1;
  }
  .stars>span {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    color: #9b6811;
    white-space: nowrap;
  }
  .rating-value {
    white-space: nowrap;
  }
  .work-card {
    background: white;
    border: 1px solid #d2d6cc;
    border-radius: 5px;
  }
  .work-card h2 {
    margin: 0 0 8px;
  }
  .review {
    border-top: 1px solid #e5e8e0;
    padding-top: 14px;
    margin-top: 14px;
  }
  .review p {
    white-space: pre-wrap;
  }
  .review-head {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
  }
  dialog {
    border: 1px solid #b5bfac;
    border-radius: 9px;
    padding: 24px;
    width: min(640px,calc(100vw - 24px));
    max-height: 90vh;
    overflow: auto;
  }
  dialog::backdrop {
    background: #14201980;
  }
  .dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
  }
  .dialog-head h2 {
    margin: 0;
  }
  .dialog-head button {
    border: 0;
  }
  #edit-fields {
    display: grid;
    gap: 15px;
    margin-top: 20px;
  }
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e2e6dc;
    padding-top: 16px;
    margin-top: 18px;
  }
  #edit-error {
    color: #a52c1e;
    white-space: pre-wrap;
  }
  .danger {
    color: #9e332a;
  }
  .rating-buttons {
    display: flex;
    gap: 0;
    align-items: center;
    margin-top: 8px;
  }
  .rating-buttons .half-star {
    border: 0;
    padding: 5px 0;
    width: 18px;
    overflow: hidden;
    border-radius: 0;
    background: transparent;
    font-size: 32px;
    line-height: 1.2;
    color: #bfc6b6;
    flex: none;
  }
  .half-star span {
    display: block;
    width: 36px;
    text-align: center;
  }
  .half-star:nth-child(even) span {
    transform: translateX(-18px);
  }
  .rating-buttons .half-star.filled {
    color: #9b6811;
  }
  .rating-buttons .clear-rating {
    font-size: 12px;
    margin-left: 16px;
  }
  .rating-label {
    font-size: 13px;
    margin-top: 4px;
  }
  footer {
    color: #66705f;
    font-size: 12px;
    margin-top: 20px;
  }
  .purchase-date {
    white-space: nowrap;
  }
  .sidebar-primary button {
    width: 100%;
    font-weight: 700;
    font-size: 14px;
  }
  .sidebar-section+.sidebar-section {
    border-top: 1px solid #d2d9ce;
  }
  .sidebar-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  .sidebar-section-head h2 {
    margin: 0;
    font-size: 13px;
    letter-spacing: .03em;
    font-weight: 700;
    color: #44553e;
  }
  .sidebar-section-head h2 span {
    margin-left: 5px;
    font-weight: 500;
    color: #72806b;
  }
  .text-action {
    border: 0;
    background: transparent;
    padding: 5px 0;
    font-size: 12px;
    color: #28553c;
  }
  .sidebar-hint,.sidebar-empty {
    font-size: 12px;
    color: #75816d;
  }
  .sidebar-section-head .sidebar-hint {
    margin: 0;
    font-size: 11px;
  }
  .all-categories {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 6px;
    padding: 10px 12px;
  }
  .all-categories.selected {
    background: #dce8d7;
    color: #1d482f;
    box-shadow: inset 3px 0 #315e43;
  }
  .category-tree {
    max-height: 350px;
    overflow: auto;
    padding: 2px 0 4px;
  }
  .category-branch {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .category-branch.nested {
    margin: 2px 0 3px 13px;
    padding-left: 14px;
    border-left: 1px solid #c8d3c2;
  }
  .category-node {
    margin: 2px 0;
    min-width: 0;
  }
  .category-row {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 38px;
    border-radius: 5px;
    position: relative;
  }
  .category-row:hover {
    background: #e3e9de;
  }
  .category-row.selected {
    background: #d6e5ce;
    box-shadow: inset 3px 0 #315e43;
  }
  .category-toggle,.category-leaf {
    flex: 0 0 28px;
    width: 28px;
    min-width: 28px;
  }
  .category-toggle {
    align-self: stretch;
    min-height: 38px;
    border: 0;
    background: transparent;
    padding: 0;
    color: #687a5d;
    font-size: 17px;
  }
  .category-leaf::after {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    margin: auto;
    border-radius: 50%;
    background: #a5b59a;
  }
  .category-select {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 9px 9px 9px 0;
    font-size: 14px;
    line-height: 1.5;
  }
  .category-select:hover {
    background: transparent;
  }
  .root-category .category-name,.work-card h2 {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
  }
  .child-category .category-name {
    font-size: 13px;
    font-weight: 500;
    color: #52614b;
  }
  .category-row.selected .category-name {
    color: #1d482f;
    font-weight: 700;
  }
  .category-name {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .category-count {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
    min-width: 21px;
    padding: 1px 5px;
    text-align: center;
    color: #66795d;
    background: #e5ebdf;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
  }
  .category-tools {
    background: #f8faf5;
    border: 1px solid #d6dfd0;
    border-radius: 7px;
  }
  .tools-caption {
    font-size: 10px;
    letter-spacing: .04em;
    color: #7b8774;
    margin-bottom: 4px;
  }
  .category-tools strong {
    display: block;
    font-size: 13px;
    overflow-wrap: anywhere;
    color: #334b2b;
  }
  .category-tool-buttons {
    display: grid;
  }
  .category-tool-buttons .danger {
    background: transparent;
    border-color: #dfd2cd;
    color: #9a6354;
  }
  .product-list {
    display: grid;
    gap: 5px;
    max-height: 380px;
    overflow: auto;
  }
  .product-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px;
    border: 1px solid transparent;
    background: #f6f8f2;
    border-radius: 6px;
  }
  .product-item:hover {
    background: #edf2e7;
    border-color: #d7e1ce;
  }
  .product-item.selected {
    background: white;
    border-color: #a7bc99;
    box-shadow: inset 3px 0 #315e43;
  }
  .product-item-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .product-name {
    min-width: 0;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.6;
    overflow-wrap: anywhere;
  }
  .purchase-count {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 10px;
    color: #6d7b62;
    padding-top: 3px;
  }
  .product-item small {
    display: block;
    font-size: 11px;
    color: #7e8975;
    line-height: 1.5;
    margin-top: 5px;
    overflow-wrap: anywhere;
  }
  .product-tools {
    display: grid;
  }
  .purchase-heading {
    padding: 0 0 18px;
    border-bottom: 1px solid #d9ded3;
    align-items: center;
  }
  .purchase-heading>div {
    min-width: 0;
    flex: 1;
  }
  .record-eyebrow {
    margin: 0 0 8px;
    font-size: 11px;
    color: #819075;
    letter-spacing: .06em;
  }
  .purchase-heading h1,.media-heading h1 {
    font-size: 26px;
    letter-spacing: -.04em;
    line-height: 1.4;
  }
  .purchase-heading .muted {
    margin: 7px 0 0;
    font-size: 12px;
  }
  .record-total {
    font-size: 28px;
    color: #334e29;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
  }
  .record-total small {
    display: block;
    font-size: 11px;
    color: #7f8b75;
  }
  .memo-title {
    font-size: 12px;
    color: #627457;
    margin-bottom: 9px;
  }
  .purchase-toolbar .muted {
    font-size: 12px;
  }
  .work-list .category-select {
    padding: 9px 9px 9px 0;
  }
  .media-heading>button {
    font-size: 14px;
    font-weight: 700;
  }
  .work-card {
    padding: 11px 14px;
    margin-top: 6px;
  }
  .work-card-heading {
    gap: 8px;
    align-items: center;
  }
  .work-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-width: 0;
    flex: 1;
  }
  .work-title-line h2 {
    margin: 0;
    overflow-wrap: anywhere;
  }
  .work-title-rating {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: 12px;
  }
  .latest-rating-label {
    color: #819075;
    font-size: 10px;
  }
  .work-card .stars {
    font-size: 16px;
    letter-spacing: 0;
  }
  .work-card .rating-value {
    font-size: 12px;
  }
  .work-card .actions {
    margin: 0;
    gap: 5px;
  }
  .work-card .actions button {
    padding: 4px 8px;
    min-height: 28px;
    font-size: 11px;
  }
  .work-card .review {
    display: grid;
    grid-template-columns: 112px minmax(0,1fr) auto;
    align-items: start;
    column-gap: 12px;
    row-gap: 3px;
    margin-top: 7px;
    padding-top: 7px;
    font-size: 13px;
    line-height: 1.5;
  }
  .review-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: #75816d;
  }
  .review-date {
    white-space: nowrap;
  }
  .work-card .review-memo {
    grid-column: 2;
    min-width: 0;
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .review-actions {
    grid-column: 3;
    grid-row: 1;
    gap: 4px;
  }
  .work-card .review-actions button {
    font-size: 11px;
    padding: 3px 7px;
    min-height: 25px;
  }
  #sidebar .work-list {
    gap: 1px;
    align-content: start;
    max-height: 380px;
    overflow: auto;
  }
  #sidebar .category-node {
    margin: 1px 0;
  }
  #sidebar .category-branch.nested {
    margin-top: 1px;
    margin-bottom: 1px;
  }
  #sidebar .category-row,#sidebar .category-toggle {
    min-height: 26px;
  }
  #sidebar .category-select {
    min-height: 26px;
    padding: 3px 9px 3px 0;
    line-height: 1.35;
  }
  #sidebar .category-name {
    line-height: 1.35;
  }
  #sidebar .all-categories {
    padding: 5px 10px;
    margin-bottom: 2px;
    line-height: 1.35;
  }
  #sidebar .product-list {
    gap: 2px;
    align-content: start;
  }
  #sidebar .product-item {
    padding: 6px 10px;
  }
  #sidebar .product-name {
    line-height: 1.35;
  }
  #sidebar .product-item small {
    margin-top: 2px;
    line-height: 1.3;
  }
  #sidebar .purchase-count {
    padding-top: 1px;
  }
  .idea-list {
    margin-top: 14px;
  }
  .idea-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    border: 1px solid #d2d6cc;
    border-radius: 5px;
    padding: 9px 12px;
    margin-top: 4px;
  }
  .idea-body {
    flex: 1;
    min-width: 0;
  }
  .idea-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .idea-body small {
    font-size: 11px;
  }
  .rating-label-value {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #81513b;
    background: #f5ece5;
    border-radius: 4px;
    padding: 2px 6px;
  }
  .work-card.movie-compact {
    padding: 0 10px;
    margin-top: 2px;
    border-radius: 3px;
  }
  .movie-line {
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 5px 0;
  }
  .movie-line+.movie-line {
    border-top: 1px solid #edf0e8;
  }
  .movie-summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 10px;
    flex: 1;
    min-width: 0;
  }
  .work-card .movie-summary h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
  }
  .movie-summary .review-date {
    font-size: 11px;
    color: #75816d;
  }
  .movie-memo {
    font-size: 12px;
    color: #66705f;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-width: 0;
  }
  .movie-line>.row-actions {
    flex-shrink: 0;
    gap: 4px;
  }
  .movie-line>.row-actions button {
    font-size: 11px;
    padding: 3px 6px;
    min-height: 25px;
  }
  .media-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .media-tools .sort-label {
    font-size: 12px;
    color: #66705f;
  }
  .media-tools select {
    width: auto;
    max-width: 100%;
    font-size: 13px;
    padding: 8px;
  }
  .media-tools button {
    font-size: 14px;
    font-weight: 700;
  }
  .movie-line {
    display: grid;
    column-gap: 12px;
  }
  .movie-line>.row-actions {
    justify-content: flex-end;
    margin-left: 0;
  }
  .aligned-rating {
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
  }
  .aligned-rating .rating-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .aligned-rating .rating-number {
    display: inline-block;
    width: 24px;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .purchase-note-fold {
    display: none;
  }
  header {
    padding: 6px 16px;
    gap: 14px;
  }
  header .brand {
    font-size: 21px;
  }
  header nav {
    gap: 10px;
  }
  header nav button {
    padding: 5px 9px;
    font-size: 13px;
  }
  #tabs {
    padding: 6px 16px;
    gap: 6px;
  }
  #tabs button {
    padding: 5px 12px;
  }
  .purchase-heading {
    padding-bottom: 8px;
    margin-bottom: 8px;
  }
  .record-eyebrow {
    margin-bottom: 3px;
  }
  .purchase-heading .muted {
    margin-top: 3px;
  }
  .purchase-toolbar {
    margin: 8px 0;
  }
  body {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body>header,body>#message,#tabs {
    flex: none;
  }
  #app {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  aside {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 10px 14px;
    overflow: auto;
  }
  .search-label {
    margin-bottom: 3px;
  }
  #search {
    flex: none;
    padding: 6px 8px;
  }
  #sidebar {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    margin-top: 8px;
  }
  #sidebar .sidebar-primary {
    flex: none;
    margin-bottom: 6px;
  }
  .sidebar-primary button {
    min-height: 32px;
    padding: 5px 10px;
  }
  .sidebar-section {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .sidebar-section+.sidebar-section {
    margin-top: 8px;
    padding-top: 8px;
  }
  .sidebar-section-head {
    flex: none;
    margin-bottom: 4px;
  }
  .sidebar-hint,.sidebar-empty {
    margin: 5px 0;
    line-height: 1.4;
  }
  #sidebar .category-tree,#sidebar .product-list,#sidebar .work-list {
    flex: 1;
    min-height: 36px;
    max-height: none;
    overflow: auto;
  }
  #sidebar .all-categories {
    flex: none;
  }
  .category-tools {
    flex: none;
    margin-top: 6px;
    padding: 6px 8px;
  }
  .tools-caption {
    display: none;
  }
  .category-tool-buttons {
    gap: 4px;
    margin-top: 4px;
  }
  .category-tool-buttons button {
    min-height: 30px;
    padding: 4px 3px;
    font-size: 11px;
    line-height: 1.3;
  }
  .category-tool-buttons button:first-child {
    grid-column: auto;
  }
  .product-tools {
    flex: none;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 6px;
  }
  .product-tools button {
    min-height: 30px;
    padding: 4px 6px;
    font-size: 11px;
  }
  .product-tools button:first-child {
    grid-column: 1/-1;
  }
  #content {
    min-height: 0;
    overflow: auto;
    padding: 12px 16px;
  }
  #message:not(:empty) {
    padding: 5px 16px;
    font-size: 13px;
  }
  .row-actions {
    flex-wrap: wrap;
  }
  .movie-line {
    grid-template-columns: minmax(0,1fr) 110px 180px;
  }
  .movie-line>.row-actions {
    width: 180px;
  }
  .movie-summary .text-action {
    font-size: 10px;
    padding: 2px 4px;
  }
  .history-preview {
    display: grid;
    grid-template-columns: 90px minmax(0,1fr);
    gap: 6px 12px;
    max-height: 45vh;
    overflow: auto;
    margin: 16px 0;
  }
  .history-preview dt {
    font-size: 12px;
    color: #66705f;
  }
  .history-preview dd {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px;
  }
  #history-error {
    color: #a52c1e;
    white-space: pre-wrap;
  }
  #history-more {
    margin-top: 8px;
    font-size: 12px;
  }
  .more-records {
    display: block;
    margin: 14px auto;
  }
  .category-tool-buttons {
    grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) 34px 34px;
  }
}

/* Mobile layout: compact cards and wrapping controls. */
@media (max-width: 850px) {
  #message:not(:empty) {
    padding: 12px 24px;
    background: #fff4d8;
    border-bottom: 1px solid #e2d5ae;
  }
  .login {
    max-width: 400px;
    margin: 70px auto;
    padding: 24px;
  }
  .login button {
    margin-top: 20px;
    width: 100%;
  }
  #tabs {
    display: flex;
    border-bottom: 1px solid #d1d5cb;
  }
  #tabs button[aria-current=true],.primary {
    background: #274b37;
    color: white;
    border-color: #274b37;
  }
  .layout {
    display: grid;
    min-height: calc(100vh - 150px);
  }
  aside {
    background: #edeee8;
  }
  .search-label {
    margin-bottom: 6px;
  }
  #sidebar {
    margin-top: 18px;
  }
  .actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 12px 0;
  }
  .side-list {
    display: grid;
    gap: 6px;
  }
  .side-list button {
    text-align: left;
    overflow-wrap: anywhere;
  }
  .side-list button small {
    display: block;
    color: #596553;
    font-weight: 400;
  }
  .side-list button.selected {
    border-color: #274b37;
    background: #dce8d7;
    font-weight: 700;
  }
  .side-title {
    font-size: 12px;
    color: #56604e;
    margin: 22px 0 8px;
  }
  .muted,.hint {
    color: #66705f;
    font-size: 13px;
  }
  .hint {
    margin: 8px 0;
  }
  .memo {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 260px;
    overflow: auto;
    background: #fffef6;
    border: 1px solid #e1dfcd;
    padding: 14px;
    border-radius: 5px;
  }
  .memo:empty::before {
    content: '메모 없음';
    color: #75786c;
  }
  #content {
    min-width: 0;
  }
  .heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 24px;
    margin: 0;
    overflow-wrap: anywhere;
  }
  h2 {
    font-size: 19px;
    margin: 12px 0;
  }
  h3 {
    font-size: 16px;
  }
  p {
    overflow-wrap: anywhere;
  }
  .table-wrap {
    border-radius: 5px;
    margin-top: 14px;
  }
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
  }
  th,td {
    border-bottom: 1px solid #e5e8e0;
    text-align: left;
    vertical-align: top;
  }
  th {
    white-space: nowrap;
    font-size: 12px;
    background: #e9ede4;
  }
  td {
    min-width: 90px;
  }
  .amount {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  td.note {
    white-space: pre-wrap;
    min-width: 180px;
    max-width: 360px;
    overflow-wrap: anywhere;
  }
  td.name {
    min-width: 170px;
  }
  .link-button {
    background: none;
    border: 0;
    padding: 0;
    color: #28553c;
    text-align: left;
    text-decoration: underline;
  }
  .row-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
  }
  .row-actions button {
    font-size: 12px;
    padding: 5px 8px;
  }
  .check {
    min-width: 36px;
    width: 36px;
  }
  .check input {
    width: 18px;
    height: 18px;
    margin: 0;
  }
  .empty {
    padding: 35px 0;
    color: #66705f;
  }
  .comparison {
    background: #e7eee2;
    margin-top: 18px;
    border-radius: 6px;
  }
  .comparison h2 {
    margin-top: 0;
  }
  .stars {
    display: inline-block;
    position: relative;
    color: #bfc6b6;
    white-space: nowrap;
    font-size: 20px;
    letter-spacing: 1px;
    line-height: 1.1;
  }
  .stars>span {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    color: #9b6811;
    white-space: nowrap;
  }
  .rating-value {
    white-space: nowrap;
  }
  .work-card {
    background: white;
    border: 1px solid #d2d6cc;
    border-radius: 5px;
  }
  .work-card h2 {
    margin: 0 0 8px;
  }
  .review {
    border-top: 1px solid #e5e8e0;
    padding-top: 14px;
    margin-top: 14px;
  }
  .review p {
    white-space: pre-wrap;
  }
  .review-head {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
  }
  dialog {
    border: 1px solid #b5bfac;
    border-radius: 9px;
    width: min(640px,calc(100vw - 24px));
    max-height: 90vh;
    overflow: auto;
  }
  dialog::backdrop {
    background: #14201980;
  }
  .dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
  }
  .dialog-head h2 {
    margin: 0;
  }
  .dialog-head button {
    border: 0;
  }
  #edit-fields {
    display: grid;
    gap: 15px;
    margin-top: 20px;
  }
  .grid {
    display: grid;
    gap: 14px;
  }
  .dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e2e6dc;
    padding-top: 16px;
    margin-top: 18px;
  }
  #edit-error {
    color: #a52c1e;
    white-space: pre-wrap;
  }
  .danger {
    color: #9e332a;
  }
  .rating-buttons {
    display: flex;
    gap: 0;
    align-items: center;
    margin-top: 8px;
  }
  .rating-buttons .half-star {
    border: 0;
    padding: 5px 0;
    width: 18px;
    overflow: hidden;
    border-radius: 0;
    background: transparent;
    font-size: 32px;
    line-height: 1.2;
    color: #bfc6b6;
    flex: none;
  }
  .half-star span {
    display: block;
    width: 36px;
    text-align: center;
  }
  .half-star:nth-child(even) span {
    transform: translateX(-18px);
  }
  .rating-buttons .half-star.filled {
    color: #9b6811;
  }
  .rating-buttons .clear-rating {
    font-size: 12px;
    margin-left: 16px;
  }
  .rating-label {
    font-size: 13px;
    margin-top: 4px;
  }
  footer {
    color: #66705f;
    font-size: 12px;
    margin-top: 20px;
  }
  #tabs button {
    min-width: 0;
    flex: 1;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  aside {
    border-right: 0;
    border-bottom: 1px solid #d1d5cb;
    padding: 16px;
  }
  .side-list {
    max-height: 230px;
    overflow: auto;
  }
  #content {
    padding: 20px 16px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  dialog {
    padding: 18px;
  }
  th,td {
    padding: 9px;
  }
  .heading {
    align-items: flex-start;
  }
  header strong {
    font-size: 14px;
  }
  header nav a {
    font-size: 12px;
  }
  .purchase-date {
    white-space: nowrap;
  }
  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .purchase-table,.purchase-table tbody {
    display: block;
    width: 100%;
  }
  .purchase-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .purchase-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    border: 1px solid #d2d6cc;
    border-radius: 6px;
    background: white;
  }
  .purchase-table td {
    display: block;
    min-width: 0;
    max-width: none;
    width: auto;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .purchase-table td::before {
    content: attr(data-label);
    font-weight: 400;
    color: #66705f;
    margin-bottom: 4px;
  }
  .purchase-table .name {
    order: 0;
    grid-column: 1/-1;
    font-weight: 600;
  }
  .purchase-table .name .muted {
    font-weight: 400;
  }
  .purchase-table .total-price {
    font-weight: 700;
    border-top: 1px solid #e5e8e0;
  }
  .purchase-table .unit-price {
    font-weight: 700;
    color: #28553c;
    border-top: 1px solid #e5e8e0;
  }
  .purchase-table .shop {
    white-space: pre-wrap;
  }
  .purchase-table .purchase-memo {
    grid-column: 1/-1;
    white-space: pre-wrap;
  }
  .purchase-table .manage::before {
    display: none;
  }
  .purchase-table .check {
    display: flex;
    align-items: center;
  }
  .purchase-table .check::before {
    margin: 0;
  }
  .comparison {
    padding: 12px;
  }
  #sidebar .sidebar-primary {
    margin-bottom: 22px;
  }
  .sidebar-primary button {
    width: 100%;
    min-height: 44px;
    font-weight: 700;
    font-size: 14px;
  }
  .sidebar-section+.sidebar-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #d2d9ce;
  }
  .sidebar-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
  }
  .sidebar-section-head h2 {
    margin: 0;
    font-size: 13px;
    letter-spacing: .03em;
    font-weight: 700;
    color: #44553e;
  }
  .sidebar-section-head h2 span {
    margin-left: 5px;
    font-weight: 500;
    color: #72806b;
  }
  .text-action {
    border: 0;
    background: transparent;
    padding: 5px 0;
    font-size: 12px;
    color: #28553c;
  }
  .sidebar-hint,.sidebar-empty {
    font-size: 12px;
    line-height: 1.65;
    color: #75816d;
    margin: 12px 0;
  }
  .sidebar-section-head .sidebar-hint {
    margin: 0;
    font-size: 11px;
  }
  .all-categories {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 6px;
    padding: 10px 12px;
  }
  .all-categories.selected {
    background: #dce8d7;
    color: #1d482f;
    box-shadow: inset 3px 0 #315e43;
  }
  .category-tree {
    overflow: auto;
    padding: 2px 0 4px;
  }
  .category-branch {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .category-branch.nested {
    margin: 2px 0 3px 13px;
    border-left: 1px solid #c8d3c2;
  }
  .category-node {
    margin: 2px 0;
    min-width: 0;
  }
  .category-row {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 38px;
    border-radius: 5px;
    position: relative;
  }
  .category-row:hover {
    background: #e3e9de;
  }
  .category-row.selected {
    background: #d6e5ce;
    box-shadow: inset 3px 0 #315e43;
  }
  .category-toggle,.category-leaf {
    flex: 0 0 28px;
    width: 28px;
    min-width: 28px;
  }
  .category-toggle {
    align-self: stretch;
    border: 0;
    background: transparent;
    padding: 0;
    color: #687a5d;
    font-size: 17px;
  }
  .category-leaf::after {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    margin: auto;
    border-radius: 50%;
    background: #a5b59a;
  }
  .category-select {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 9px 9px 9px 0;
    font-size: 14px;
    line-height: 1.5;
  }
  .category-select:hover {
    background: transparent;
  }
  .root-category .category-name,.work-card h2 {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
  }
  .child-category .category-name {
    font-size: 13px;
    font-weight: 500;
    color: #52614b;
  }
  .category-row.selected .category-name {
    color: #1d482f;
    font-weight: 700;
  }
  .category-name {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .category-count {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
    min-width: 21px;
    padding: 1px 5px;
    text-align: center;
    color: #66795d;
    background: #e5ebdf;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
  }
  .category-tools {
    margin-top: 14px;
    padding: 13px;
    background: #f8faf5;
    border: 1px solid #d6dfd0;
    border-radius: 7px;
  }
  .tools-caption {
    display: block;
    font-size: 10px;
    letter-spacing: .04em;
    color: #7b8774;
    margin-bottom: 4px;
  }
  .category-tools strong {
    display: block;
    font-size: 13px;
    overflow-wrap: anywhere;
    color: #334b2b;
  }
  .category-tool-buttons {
    display: grid;
    gap: 6px;
    margin-top: 11px;
  }
  .category-tool-buttons button {
    font-size: 12px;
    padding: 8px 6px;
  }
  .category-tool-buttons .danger {
    background: transparent;
    border-color: #dfd2cd;
    color: #9a6354;
  }
  .product-list {
    display: grid;
    gap: 5px;
    overflow: auto;
  }
  .product-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px;
    border: 1px solid transparent;
    background: #f6f8f2;
    border-radius: 6px;
  }
  .product-item:hover {
    background: #edf2e7;
    border-color: #d7e1ce;
  }
  .product-item.selected {
    background: white;
    border-color: #a7bc99;
    box-shadow: inset 3px 0 #315e43;
  }
  .product-item-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .product-name {
    min-width: 0;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.6;
    overflow-wrap: anywhere;
  }
  .purchase-count {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 10px;
    color: #6d7b62;
    padding-top: 3px;
  }
  .product-item small {
    display: block;
    font-size: 11px;
    color: #7e8975;
    line-height: 1.5;
    margin-top: 5px;
    overflow-wrap: anywhere;
  }
  .product-tools {
    display: grid;
    gap: 6px;
    margin-top: 12px;
  }
  .product-tools button {
    font-size: 12px;
    min-height: 36px;
  }
  .purchase-heading {
    padding: 0 0 18px;
    border-bottom: 1px solid #d9ded3;
    align-items: center;
  }
  .purchase-heading>div {
    min-width: 0;
    flex: 1;
  }
  .record-eyebrow {
    margin: 0 0 8px;
    font-size: 11px;
    color: #819075;
    letter-spacing: .06em;
  }
  .purchase-heading h1,.media-heading h1 {
    letter-spacing: -.04em;
    line-height: 1.4;
  }
  .purchase-heading .muted {
    margin: 7px 0 0;
    font-size: 12px;
  }
  .record-total {
    font-size: 28px;
    color: #334e29;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
  }
  .record-total small {
    display: block;
    font-size: 11px;
    color: #7f8b75;
  }
  .memo-title {
    font-size: 12px;
    color: #627457;
    margin-bottom: 9px;
  }
  .purchase-toolbar .muted {
    font-size: 12px;
  }
  .category-tree {
    max-height: 250px;
  }
  .product-list {
    max-height: 220px;
  }
  .category-branch.nested {
    margin-left: 12px;
    padding-left: 12px;
  }
  .category-select {
    min-height: 42px;
  }
  .category-toggle {
    min-height: 42px;
  }
  .category-tool-buttons button {
    min-height: 40px;
  }
  .purchase-heading h1,.media-heading h1 {
    font-size: 23px;
  }
  .work-list .category-select {
    padding: 9px 9px 9px 0;
  }
  .media-heading>button {
    font-size: 14px;
    font-weight: 700;
  }
  .work-card-heading {
    align-items: center;
  }
  .work-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-width: 0;
    flex: 1;
  }
  .work-title-line h2 {
    margin: 0;
    overflow-wrap: anywhere;
  }
  .work-title-rating {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: 12px;
  }
  .latest-rating-label {
    color: #819075;
    font-size: 10px;
  }
  .work-card .stars {
    font-size: 16px;
    letter-spacing: 0;
  }
  .work-card .rating-value {
    font-size: 12px;
  }
  .work-card .actions {
    margin: 0;
    gap: 5px;
  }
  .work-card .actions button {
    font-size: 11px;
  }
  .work-card .review {
    display: grid;
    align-items: start;
    column-gap: 12px;
    row-gap: 3px;
    margin-top: 7px;
    padding-top: 7px;
    font-size: 13px;
    line-height: 1.5;
  }
  .review-meta {
    display: flex;
    font-size: 11px;
    color: #75816d;
  }
  .review-date {
    white-space: nowrap;
  }
  .work-card .review-memo {
    min-width: 0;
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .review-actions {
    gap: 4px;
  }
  .work-card .review-actions button {
    font-size: 11px;
  }
  .work-card {
    padding: 10px 12px;
    margin-top: 6px;
  }
  .work-card-heading {
    gap: 6px;
  }
  .work-title-line {
    flex-basis: 100%;
  }
  .work-card .actions button {
    min-height: 32px;
    padding: 5px 9px;
  }
  .work-card .review {
    grid-template-columns: minmax(0,1fr) auto;
    gap: 5px 8px;
  }
  .review-meta {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .review-actions {
    grid-column: 2;
    grid-row: 1;
  }
  .work-card .review-memo {
    grid-column: 1/-1;
    grid-row: 2;
  }
  .work-card .review-actions button {
    min-height: 30px;
    padding: 4px 8px;
  }
  #sidebar .work-list {
    gap: 1px;
    align-content: start;
    overflow: auto;
  }
  #sidebar .category-node {
    margin: 1px 0;
  }
  #sidebar .category-branch.nested {
    margin-top: 1px;
    margin-bottom: 1px;
  }
  #sidebar .category-row,#sidebar .category-toggle {
    min-height: 26px;
  }
  #sidebar .category-select {
    min-height: 26px;
    padding: 3px 9px 3px 0;
    line-height: 1.35;
  }
  #sidebar .category-name {
    line-height: 1.35;
  }
  #sidebar .all-categories {
    padding: 5px 10px;
    margin-bottom: 2px;
    line-height: 1.35;
  }
  #sidebar .product-list {
    gap: 2px;
    align-content: start;
  }
  #sidebar .product-item {
    padding: 6px 10px;
  }
  #sidebar .product-name {
    line-height: 1.35;
  }
  #sidebar .product-item small {
    margin-top: 2px;
    line-height: 1.3;
  }
  #sidebar .purchase-count {
    padding-top: 1px;
  }
  #sidebar .work-list {
    max-height: 230px;
  }
  #sidebar .category-row,#sidebar .category-toggle,#sidebar .category-select {
    min-height: 30px;
  }
  .idea-list {
    margin-top: 14px;
  }
  .idea-row {
    display: flex;
    align-items: flex-start;
    background: white;
    border: 1px solid #d2d6cc;
    border-radius: 5px;
    margin-top: 4px;
  }
  .idea-body {
    flex: 1;
    min-width: 0;
  }
  .idea-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .idea-body small {
    font-size: 11px;
  }
  #tabs button {
    font-size: 14px;
  }
  .idea-row {
    padding: 9px;
    gap: 8px;
  }
  .idea-row .row-actions button {
    min-height: 32px;
  }
  .rating-label-value {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #81513b;
    background: #f5ece5;
    border-radius: 4px;
    padding: 2px 6px;
  }
  .work-card.movie-compact {
    margin-top: 2px;
    border-radius: 3px;
  }
  .movie-line {
    align-items: center;
    min-width: 0;
  }
  .movie-line+.movie-line {
    border-top: 1px solid #edf0e8;
  }
  .movie-summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
  }
  .work-card .movie-summary h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
  }
  .movie-summary .review-date {
    font-size: 11px;
    color: #75816d;
  }
  .movie-memo {
    font-size: 12px;
    color: #66705f;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-width: 0;
  }
  .movie-line>.row-actions {
    flex-shrink: 0;
    gap: 4px;
  }
  .movie-line>.row-actions button {
    font-size: 11px;
  }
  .work-card.movie-compact {
    padding: 0 8px;
  }
  .movie-line {
    padding: 6px 0;
  }
  .movie-summary {
    flex-basis: 100%;
    gap: 2px 8px;
  }
  .movie-line>.row-actions button {
    min-height: 30px;
    padding: 4px 8px;
  }
  .media-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  .media-tools .sort-label {
    font-size: 12px;
    color: #66705f;
  }
  .media-tools select {
    width: auto;
    max-width: 100%;
    font-size: 13px;
    padding: 8px;
  }
  .media-tools button {
    font-weight: 700;
  }
  .media-tools {
    gap: 6px;
  }
  .media-tools button {
    font-size: 13px;
  }
  .movie-line>.row-actions {
    justify-content: flex-end;
  }
  .aligned-rating {
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
  }
  .aligned-rating .rating-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .aligned-rating .rating-number {
    display: inline-block;
    width: 24px;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .movie-line {
    column-gap: 8px;
  }
  .movie-summary {
    grid-column: 1/-1;
  }
  .aligned-rating {
    grid-column: 1;
    justify-self: end;
  }
  .movie-line>.row-actions {
    grid-column: 2;
  }
  .purchase-table tbody tr {
    padding: 8px 10px;
    margin-bottom: 6px;
    gap: 0 10px;
  }
  .purchase-table td {
    padding: 3px 0;
    font-size: 12px;
    line-height: 1.4;
  }
  .purchase-table td::before {
    display: inline;
    font-size: 10px;
    margin: 0 5px 0 0;
  }
  .purchase-table .name {
    font-size: 14px;
    padding-bottom: 5px;
  }
  .purchase-table .name::before {
    display: none;
  }
  .purchase-table .name .muted {
    font-size: 10px;
    line-height: 1.3;
    margin-top: 2px;
  }
  .purchase-table .purchase-date {
    order: 1;
    grid-column: 1;
    font-size: 11px;
    color: #66705f;
  }
  .purchase-table .shop {
    order: 2;
    grid-column: 2;
    font-size: 11px;
  }
  .purchase-table .total-price {
    order: 3;
    font-size: 14px;
    padding-top: 5px;
    margin-top: 2px;
  }
  .purchase-table .unit-price {
    order: 4;
    font-size: 13px;
    padding-top: 5px;
    margin-top: 2px;
  }
  .purchase-table .total-price::before,.purchase-table .unit-price::before {
    display: block;
    margin: 0 0 1px;
    font-size: 10px;
  }
  .purchase-table .quantity {
    order: 5;
  }
  .purchase-table .spec {
    order: 6;
  }
  .purchase-table .purchase-memo {
    order: 7;
    font-size: 11px;
    padding: 4px 0;
  }
  .purchase-table .purchase-memo[data-empty=true] {
    display: none;
  }
  .purchase-table .check {
    order: 8;
    grid-column: 1;
    gap: 5px;
    font-size: 10px;
    padding-top: 5px;
  }
  .purchase-table .check::before {
    font-size: 10px;
  }
  .purchase-table .check input {
    width: 18px;
    height: 18px;
  }
  .purchase-table .manage {
    order: 9;
    padding-top: 5px;
  }
  .purchase-table .row-actions {
    justify-content: flex-end;
    gap: 5px;
  }
  .purchase-table .row-actions button {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 11px;
  }
  .purchase-note-full {
    display: none;
  }
  .purchase-note-fold {
    display: inline;
    font-size: 11px;
    white-space: normal;
  }
  .purchase-note-fold summary {
    display: inline;
    cursor: pointer;
    color: #28553c;
    text-decoration: underline;
  }
  .purchase-note-fold[open] summary {
    display: block;
    margin-bottom: 3px;
  }
  .purchase-note-fold div {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  #app[data-active-tab=purchases] aside {
    padding: 12px 16px;
  }
  #app[data-active-tab=purchases] #tabs button {
    padding: 8px 9px;
    white-space: nowrap;
    font-size: 13px;
  }
  #app[data-active-tab=purchases] #sidebar {
    margin-top: 10px;
  }
  #app[data-active-tab=purchases] #sidebar .sidebar-primary {
    margin-bottom: 10px;
  }
  #app[data-active-tab=purchases] .sidebar-primary button {
    min-height: 36px;
  }
  #app[data-active-tab=purchases] .sidebar-section+.sidebar-section {
    margin-top: 12px;
    padding-top: 10px;
  }
  #app[data-active-tab=purchases] .sidebar-section-head {
    margin-bottom: 6px;
  }
  #app[data-active-tab=purchases] .sidebar-hint {
    margin: 6px 0;
  }
  #app[data-active-tab=purchases] .category-tree {
    max-height: 140px;
  }
  #app[data-active-tab=purchases] .product-list {
    max-height: 140px;
  }
  #app[data-active-tab=purchases] .category-tools {
    margin-top: 8px;
    padding: 8px;
  }
  #app[data-active-tab=purchases] .category-tool-buttons {
    margin-top: 6px;
  }
  #app[data-active-tab=purchases] .category-tool-buttons button {
    min-height: 32px;
    padding: 5px;
  }
  #app[data-active-tab=purchases] .product-tools {
    gap: 4px;
    margin-top: 7px;
  }
  #app[data-active-tab=purchases] .product-tools button {
    min-height: 32px;
    padding: 5px 8px;
  }
  #app[data-active-tab=purchases] #content {
    padding: 14px 16px;
  }
  #app[data-active-tab=purchases] .purchase-heading {
    padding-bottom: 8px;
    margin-bottom: 8px;
    gap: 8px;
  }
  #app[data-active-tab=purchases] .purchase-heading h1 {
    font-size: 19px;
  }
  #app[data-active-tab=purchases] .record-eyebrow {
    margin-bottom: 3px;
    font-size: 10px;
  }
  #app[data-active-tab=purchases] .purchase-heading .muted {
    margin-top: 3px;
    font-size: 11px;
  }
  #app[data-active-tab=purchases] .record-total {
    font-size: 22px;
  }
  #app[data-active-tab=purchases] .purchase-toolbar {
    margin: 8px 0;
    gap: 5px;
  }
  #app[data-active-tab=purchases] .purchase-toolbar button {
    padding: 5px 9px;
    font-size: 12px;
  }
  #app[data-active-tab=purchases] .purchase-toolbar .muted {
    font-size: 10px;
  }
  #app[data-active-tab=purchases] .table-wrap {
    margin-top: 8px;
  }
  .purchase-navigation>summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
    padding: 7px 9px;
    border: 1px solid #c9d3c1;
    background: #f8faf5;
    border-radius: 5px;
    overflow-wrap: anywhere;
  }
  .purchase-navigation>summary small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: #66705f;
    margin-left: 14px;
  }
  .purchase-navigation[open]>summary {
    margin-bottom: 9px;
  }
  header .brand {
    font-size: 21px;
  }
  header nav button {
    padding: 5px 9px;
    font-size: 13px;
  }
  #tabs {
    gap: 6px;
  }
  #tabs button {
    padding: 5px 12px;
  }
  .purchase-heading {
    padding-bottom: 8px;
    margin-bottom: 8px;
  }
  .record-eyebrow {
    margin-bottom: 3px;
  }
  .purchase-heading .muted {
    margin-top: 3px;
  }
  .purchase-toolbar {
    margin: 8px 0;
  }
  header {
    padding: 6px 12px;
    gap: 8px;
  }
  #tabs {
    padding: 6px 12px;
  }
  #app aside,#app[data-active-tab=purchases] aside {
    padding: 8px 12px;
  }
  #app #sidebar {
    margin-top: 6px;
  }
  #app #sidebar .sidebar-primary {
    margin-bottom: 6px;
  }
  #app #content {
    padding: 10px 12px;
  }
  .row-actions {
    flex-wrap: wrap;
  }
  .movie-line {
    grid-template-columns: minmax(0,1fr) 110px 180px;
  }
  .movie-summary .text-action {
    font-size: 10px;
    padding: 2px 4px;
  }
  .history-preview {
    display: grid;
    grid-template-columns: 90px minmax(0,1fr);
    gap: 6px 12px;
    max-height: 45vh;
    overflow: auto;
    margin: 16px 0;
  }
  .history-preview dt {
    font-size: 12px;
    color: #66705f;
  }
  .history-preview dd {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px;
  }
  #history-error {
    color: #a52c1e;
    white-space: pre-wrap;
  }
  #history-more {
    margin-top: 8px;
    font-size: 12px;
  }
  .more-records {
    display: block;
    margin: 14px auto;
  }
  header nav {
    flex-wrap: wrap;
    gap: 6px;
  }
  .movie-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  .movie-summary {
    flex: 1 0 100%;
    min-width: 0;
  }
  .aligned-rating {
    margin-left: auto;
  }
  .movie-line>.row-actions {
    width: auto;
    max-width: 100%;
    margin-left: auto;
  }
  .purchase-table .manage {
    grid-column: 1/-1;
  }
  .purchase-table .row-actions {
    flex-wrap: wrap;
  }
  .category-tool-buttons {
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  }
  .category-tool-buttons button:first-child {
    grid-column: auto;
  }
  #history-dialog {
    padding: 14px;
  }
}
