:root {
  --emerald: #0B3D2E; --forest: #145A32; --gold: #D4AF37; --gold-soft: #F3E6B8; --ivory: #F8F5EE;
  --wood: #4A3425; --ink: #1f2a24; --muted: #66706a; --line: #E4DED0; --card: #fff; --danger: #B3261E; --ok: #1E6B34;
  --r: 12px; --shadow: 0 1px 2px rgba(11,61,46,.06), 0 8px 24px rgba(11,61,46,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ivory); color: var(--ink); font: 15px/1.5 'Noto Sans', 'Noto Sans Tamil', system-ui, sans-serif; min-height: 100dvh; }
h1, h2, h3 { font-family: 'Crimson Pro', Georgia, serif; color: var(--emerald); margin: 0; line-height: 1.15; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
a { color: var(--forest); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100dvh; }
.side { background: var(--emerald); color: #E9E4D6; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font-family: 'Crimson Pro', serif; font-size: 20px; color: #fff; display: block; line-height: 1.05; }
.brand small { color: var(--gold); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #E9E4D6; text-decoration: none; font-weight: 500; min-height: 44px; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav:hover { background: rgba(255,255,255,.07); }
.nav.on { background: rgba(212,175,55,.16); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side .sp { flex: 1; }
.who { font-size: 13px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.12); color: #cfc9b8; }
.who b { color: #fff; display: block; }
.who button { margin-top: 8px; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.main { padding: 28px 32px 60px; min-width: 0; max-width: 1280px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.grid2 { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 20px; align-items: start; }

/* forms */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #3b463f; }
label.f small { font-weight: 400; color: var(--muted); }
input, select, textarea { border: 1px solid #D6CFBE; border-radius: 9px; padding: 9px 11px; background: #fff; min-height: 42px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--forest); outline: none; box-shadow: 0 0 0 3px rgba(20,90,50,.14); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; min-height: 18px; accent-color: var(--forest); }
.seg { display: inline-flex; background: #EFEAE0; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); min-height: 36px; }
.seg button.on { background: #fff; color: var(--emerald); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-weight: 600; cursor: pointer; min-height: 44px; transition: background .15s, transform .1s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-p { background: var(--emerald); color: #fff; }
.btn-p:hover { background: var(--forest); }
.btn-g { background: var(--gold); color: #1A1A1A; }
.btn-g:hover { background: #c9a42f; }
.btn-o { background: #fff; border-color: #D6CFBE; color: var(--emerald); }
.btn-o:hover { border-color: var(--emerald); }
.btn-d { background: #fff; border-color: #EBC5C1; color: var(--danger); }
.btn-s { padding: 6px 12px; min-height: 36px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #F0EBE0; vertical-align: middle; }
tr:hover td { background: #FCFAF5; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; border: 1px solid rgba(0,0,0,.1); }
.muted { color: var(--muted); }
.warn { background: #FFF6DA; border: 1px solid #E8D48A; color: #5b4a0e; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.err { background: #FDECEA; border: 1px solid #F1BDB7; color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.okmsg { background: #E6F4EA; border: 1px solid #B9DFC3; color: var(--ok); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; }

/* print studio */
.picker { max-height: 290px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #F3EFE6; min-height: 44px; }
.pick:hover { background: #FAF7F0; }
.pick.on { background: #EEF6F0; box-shadow: inset 3px 0 0 var(--forest); }
.pick .t { flex: 1; min-width: 0; }
.pick .t b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .t span { font-size: 12px; color: var(--muted); }
.stage { background: repeating-conic-gradient(#F1ECE1 0 25%, #F8F5EE 0 50%) 0 0/20px 20px; border-radius: var(--r); min-height: 360px; display: flex; align-items: center; justify-content: center; padding: 28px; overflow: hidden; border: 1px solid var(--line); }
.stage-inner { transform-origin: center; filter: drop-shadow(0 6px 18px rgba(0,0,0,.14)); }
.size-tag { font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.size-tag b { color: var(--ink); }
.tpls { display: flex; gap: 8px; flex-wrap: wrap; }
.tpls button { border: 1px solid #D6CFBE; background: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 13px; font-weight: 600; min-height: 40px; }
.tpls button.on { border-color: var(--emerald); background: #EEF6F0; color: var(--emerald); }

/* colour lines */
.lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.line-card { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.line-card .sw { height: 64px; display: flex; align-items: flex-end; padding: 10px 14px; font-weight: 700; letter-spacing: .06em; }
.line-card .bd { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.colorpick { display: flex; gap: 8px; align-items: center; }
.colorpick input[type=color] { width: 48px; padding: 2px; min-height: 42px; flex: none; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,25,20,.45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 720px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .head { margin-bottom: 14px; }

/* login */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--emerald); color: #EFE9D8; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { color: #fff; font-size: 44px; max-width: 12ch; }
.login-art p { max-width: 42ch; color: #cfc9b8; }
.login-art .swatches { display: flex; gap: 10px; }
.login-art .swatches span { width: 44px; height: 70px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-form form { width: 100%; max-width: 380px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--emerald); color: #fff; padding: 12px 20px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 99; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--danger); }

.mobile-top { display: none; }
@media (max-width: 960px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; max-width: 280px; z-index: 40; transform: translateX(-105%); transition: transform .22s; height: 100dvh; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .mobile-top { display: flex; align-items: center; gap: 12px; background: var(--emerald); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .mobile-top button { background: none; border: 0; color: #fff; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
  .mobile-top b { font-family: 'Crimson Pro', serif; font-size: 19px; }
  .main { padding: 18px 16px 60px; }
  .row, .row3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 20px; }
  .login-art h1 { font-size: 32px; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1; }
  input, select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* prevent wide label previews from forcing horizontal scroll */
.shell > *, .grid2 > *, .stack > * { min-width: 0; }
.stage { width: 100%; }
/* design gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.gcell { display: flex; flex-direction: column; gap: 2px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.gcell:hover { border-color: #C9BFA8; box-shadow: var(--shadow); }
.gcell.on { border-color: var(--emerald); box-shadow: 0 0 0 2px rgba(11,61,46,.25); }
.gcell b { font-size: 14px; color: var(--emerald); padding: 4px 4px 0; }
.gcell span { font-size: 12px; color: var(--muted); padding: 0 4px; }
.gstage { height: 150px; border-radius: 8px; background: #F1ECE1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gstage .stage-inner { filter: drop-shadow(0 2px 6px rgba(0,0,0,.15)); }
