* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #f6f5f1;
  color: #22301f;
}
header {
  background: #3a5a40;
  color: #fff;
  padding: 1.25rem 2rem;
}
header h1 { margin: 0; font-size: 1.4rem; }
.subtitle { margin: .25rem 0 0; opacity: .85; font-size: .9rem; }
.header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.logout-link { color: #fff; opacity: .85; font-size: .85rem; text-decoration: none; border: 1px solid rgba(255,255,255,.5); border-radius: 6px; padding: .35rem .8rem; white-space: nowrap; }
.logout-link:hover { opacity: 1; background: rgba(255,255,255,.1); }
main { padding: 1.5rem 2rem 3rem; max-width: 1400px; margin: 0 auto; }
section { background: #fff; border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
h2 { margin-top: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 0; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; }
label { display: flex; flex-direction: column; font-size: .82rem; font-weight: 600; gap: .3rem; color: #4a5a48; }
input, select { font-size: .95rem; padding: .45rem .5rem; border: 1px solid #d3d3cc; border-radius: 6px; font-family: inherit; }
.preview { margin: .9rem 0; font-size: .9rem; color: #3a5a40; min-height: 1.2em; }
button { background: #3a5a40; color: #fff; border: none; padding: .6rem 1.4rem; border-radius: 6px; font-size: .95rem; cursor: pointer; }
button:hover { background: #2d4732; }
.secondary-btn { background: #fff; color: #3a5a40; border: 1px solid #3a5a40; padding: .35rem .9rem; border-radius: 6px; font-size: .82rem; font-weight: 600; cursor: pointer; margin-left: .75rem; vertical-align: middle; }
.secondary-btn:hover { background: #f0efe9; }
.error { color: #b3261e; margin-left: 1rem; font-size: .85rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; white-space: nowrap; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid #eee; text-align: left; }
th { background: #f0efe9; position: sticky; top: 0; }
tr:hover td { background: #fafaf6; }
.badge { display: inline-block; background: #e6e2d8; color: #6b6455; padding: .2rem .55rem; border-radius: 10px; font-size: .78rem; font-weight: 600; }
.badge-available { background: #dcefdc; color: #2d6a2f; }
.badge-notready { background: #fbe8cc; color: #8a5a1f; }
.badge-soldout { background: #e6e2d8; color: #6b6455; }
.badge-doa { background: #f6d9d6; color: #9c2b1f; }
.record-sale summary { cursor: pointer; color: #3a5a40; font-weight: 600; font-size: .82rem; }
.record-sale .sale-form { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; min-width: 180px; white-space: normal; }
.record-sale .sale-form label { font-size: .72rem; }
.record-sale .sale-form input, .record-sale .sale-form select { font-size: .82rem; padding: .3rem .4rem; }
.record-sale .sale-form button { padding: .35rem .8rem; font-size: .82rem; align-self: flex-start; }
.sale-error { margin-left: 0; display: block; }
.edit-item summary { cursor: pointer; color: #3a5a40; font-weight: 600; font-size: .82rem; }
.edit-item .edit-item-form { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; min-width: 220px; white-space: normal; }
.edit-item .edit-item-form label { font-size: .72rem; }
.edit-item .edit-item-form input, .edit-item .edit-item-form select { font-size: .82rem; padding: .3rem .4rem; }
.edit-item .edit-item-form button { padding: .35rem .8rem; font-size: .82rem; align-self: flex-start; }
.edit-error { margin-left: 0; display: block; }
input[readonly] { background: #f3f2ee; color: #6b6455; }
.sku-input { width: 100px; }
.reconciliation form { display: flex; align-items: center; gap: 1rem; }
#import-summary { margin-top: 1rem; font-size: .88rem; }
.unmatched-table { margin-top: .75rem; font-size: .8rem; white-space: normal; }
.unmatched-table th, .unmatched-table td { padding: .35rem .5rem; border-bottom: 1px solid #eee; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; }
.stat-tile { background: #f6f5f1; border-radius: 8px; padding: .9rem 1rem; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: #3a5a40; }
.stat-label { font-size: .78rem; color: #6b6455; margin-top: .2rem; }
.breakdown table { font-size: .88rem; white-space: normal; }
.login-form { max-width: 360px; margin: 3rem auto 0; }
.login-form form { display: flex; flex-direction: column; gap: 1rem; }
.login-form button { margin-top: .25rem; }
.login-form .error { margin-left: 0; }
