:root {
  --orange: #E8562E; --orange-deep: #C8401B; --brown: #563923; --yellow: #FEF1BA; --pastel-orange: #F9CE7C;
  --bg: #FFFBEA; --card: #FFFFFF; --line: #F3E2CC; --field: #E5C9A8; --muted: #7A5A40;
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Montserrat', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--brown); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: var(--orange-deep); }
:focus-visible { outline: 3px solid var(--orange-deep); outline-offset: 2px; }
h1 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 38px; line-height: 1.1; }
p { margin: 0; }
.muted { color: var(--muted); margin-top: 4px; }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.ref { font-size: 13px; color: var(--muted); }
.sub { margin: 6px 0 22px; font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 2px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-dark { background: var(--brown); color: var(--yellow); }
.btn-dark:hover { background: var(--orange-deep); color: #fff; }
.btn-line { background: transparent; color: var(--brown); border-color: var(--field); }
.btn-line:hover { border-color: var(--brown); }
.btn-danger { background: transparent; color: #A1271B; border-color: #EBC0B8; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.link { background: none; border: 0; padding: 8px 0; color: var(--orange-deep); cursor: pointer; text-align: left; font-weight: 600; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.check input { width: 20px; height: 20px; accent-color: var(--orange-deep); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number], select, textarea {
  min-height: 44px; padding: 0 12px; border: 1.5px solid var(--field); border-radius: 10px; background: #fff; color: var(--brown); font-size: 16px; font-weight: 400;
}
textarea { padding: 10px 12px; resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--yellow); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 20px; padding: 32px; box-shadow: 0 1px 0 var(--line); }
.auth-logo { height: 44px; width: auto; }
.auth-card h1 { font-size: 30px; }
.msg { margin-top: 16px; color: var(--muted); min-height: 1.5em; }
.msg.err { color: #A1271B; }

/* layout */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 230px; background: var(--yellow); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-family: var(--serif); font-weight: 700; font-size: 26px; color: var(--orange-deep); }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tabs button { text-align: left; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--brown); font-weight: 700; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--brown); color: var(--yellow); }
.side-foot { margin-top: auto; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.side-foot .who { color: var(--brown); font-weight: 600; margin-bottom: 8px; word-break: break-all; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 32px 48px; }
@media (max-width: 640px) { .main { padding: 24px 16px; } h1 { font-size: 30px; } }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.card { margin-top: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.narrow { max-width: 640px; padding: 24px; }
.toast { position: sticky; top: 12px; z-index: 5; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #E3EEDF; color: #2C5427; font-weight: 600; }
.toast.err { background: #F6E1DC; color: #9B2C1F; }

/* forms */
.form-grid { padding: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.drop { grid-row: span 3; border: 2px dashed var(--field); border-radius: 14px; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; }
.drop img { max-height: 200px; width: auto; border-radius: 8px; }
.drop img:not([src]), .drop img[src=""] { display: none; }
.drop input { font-size: 13px; max-width: 100%; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
th { text-align: left; background: var(--yellow); font-size: 13px; font-weight: 700; padding: 12px; }
th:first-child, td:first-child { padding-left: 20px; }
th.r, td.r { text-align: right; padding-right: 20px; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
td.empty { padding: 28px 20px; color: var(--muted); }
.thumb { width: 42px; height: 56px; flex-shrink: 0; object-fit: cover; border-radius: 6px; background: var(--yellow); }
.item-cell { display: flex; align-items: center; gap: 12px; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.on { background: #E3EEDF; color: #2C5427; }
.pill.off { background: #EEE6DD; color: #6B5442; }
.pill.wait { background: var(--yellow); color: #7A4B00; }
