:root {
    --brand:        #5f4781;   /* sampled directly from the logo */
    --brand-dark:   #44335c;
    --brand-darker: #342746;
    --brand-light:  #9787ad;
    --brand-wash:   #f2f0f4;   /* pale tint for subtle backgrounds */
    --accent:       #789b49;   /* logo's leaf green */
    --accent-dark:  #5a7436;
    --bg:           #f6f5f9;
    --card:         #ffffff;
    --border:       #e6e2ec;
    --text:         #2a2333;
    --muted:        #7c7189;
    --success:      #3c8c5c;
    --danger:       #c0392b;
    --radius:       12px;
    --shadow-sm:    0 1px 3px rgba(47, 34, 71, .07);
    --shadow-md:    0 6px 20px rgba(47, 34, 71, .10);
    --shadow-lg:    0 14px 34px rgba(47, 34, 71, .16);
    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--brand-dark); }

/* ---------------- Brand mark ---------------- */
.brand-logo {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; letter-spacing: .01em;
}
.brand-logo img { height: 34px; width: 34px; object-fit: contain; display: block; }
.brand-logo .brand-text { line-height: 1.05; }
.brand-logo .brand-text small { display: block; font-weight: 500; opacity: .75; font-size: .68em; letter-spacing: .06em; }

/* ---------------- Topbar ---------------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    padding: 10px 22px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 10;
}
.topbar-brand { font-weight: 700; font-size: 1.1rem; }
.topbar-nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.topbar-nav a {
    color: #ece7f2; padding: 7px 13px; border-radius: 20px;
    font-size: .92rem; transition: background .18s var(--ease), color .18s var(--ease);
}
.topbar-nav a.active, .topbar-nav a:hover { background: rgba(255,255,255,.18); color: #fff; }
.topbar-nav a.active { box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.topbar-user em { opacity: .8; font-style: normal; }
.btn-link { color: #fff; text-decoration: underline; }

.page { padding: 20px; max-width: 1400px; margin: 0 auto; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px; }

/* ---------------- Generic components ---------------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s var(--ease);
}
h1, h2, h3 { color: var(--brand-darker); margin-top: 0; }

.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(95, 71, 129, .28);
    transition: transform .12s var(--ease), box-shadow .18s var(--ease), filter .15s var(--ease);
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(95, 71, 129, .36); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.secondary { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); box-shadow: none; }
.btn.secondary:hover { background: var(--brand-wash); filter: none; }
.btn.danger { background: linear-gradient(135deg, #d1493a, var(--danger)); box-shadow: 0 2px 8px rgba(192, 57, 43, .3); }
.btn.small { padding: 5px 11px; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: .92rem; }
table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
table tr:hover td { background: var(--brand-wash); }

input, select, textarea {
    font-size: .95rem;
    padding: 9px 11px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    width: 100%;
    background: #fff;
    color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(95, 71, 129, .14);
}
label { font-size: .85rem; color: var(--muted); display: block; margin-bottom: 4px; font-weight: 600; }
.field { margin-bottom: 12px; }

.alert { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; font-size: .9rem; border-left: 3px solid transparent; }
.alert.error { background: #fbe4e1; color: var(--danger); border-color: var(--danger); }
.alert.success { background: #e9f3ea; color: var(--success); border-color: var(--success); }

/* ---------------- Login ---------------- */
.login-wrap {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: radial-gradient(circle at 20% 15%, var(--brand-wash) 0%, var(--bg) 55%);
}
.login-box { width: 350px; box-shadow: var(--shadow-lg); }
.login-box .brand-logo { justify-content: center; width: 100%; margin-bottom: 6px; }
.login-box .brand-logo img { height: 56px; width: 56px; }
.login-box h1 { text-align: center; font-size: 1.3rem; }

/* ---------------- POS layout ---------------- */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: flex-start; }
.categories { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.categories button {
    background: #fff; border: 1.5px solid var(--border); padding: 8px 15px;
    border-radius: 20px; cursor: pointer; font-size: .85rem; font-weight: 600;
    color: var(--text); transition: all .15s var(--ease);
}
.categories button:hover { border-color: var(--brand-light); }
.categories button.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(95, 71, 129, .3);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.product-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px; cursor: pointer; text-align: left;
    transition: transform .15s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.product-card:hover { border-color: var(--brand-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card:active { transform: translateY(0) scale(.98); }
.product-card .pname { font-weight: 600; font-size: .88rem; min-height: 40px; }
.product-card .pprice { color: var(--brand); font-weight: 700; margin-top: 6px; }

/* Cart panel */
.cart-panel {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; position: sticky; top: 12px; box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--brand);
}
.cart-lines { max-height: 300px; overflow-y: auto; margin: 10px 0; }
.cart-line { border-bottom: 1px solid var(--border); padding: 8px 0; font-size: .87rem; animation: fadeIn .25s var(--ease); }
.cart-line .lname { font-weight: 600; }
.cart-line .lmeta { color: var(--muted); font-size: .78rem; }
.cart-line .lrow { display: flex; justify-content: space-between; align-items: center; }
.cart-line .remove { color: var(--danger); cursor: pointer; font-size: .78rem; transition: opacity .15s; }
.cart-line .remove:hover { opacity: .7; }
.totals-row { display: flex; justify-content: space-between; font-size: .9rem; margin: 4px 0; }
.totals-row.grand {
    font-size: 1.2rem; font-weight: 700; color: var(--brand);
    border-top: 1px dashed var(--border); padding-top: 9px; margin-top: 9px;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Modal */
.modal-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(42, 35, 51, .55);
    align-items: center; justify-content: center; z-index: 50; backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; animation: fadeIn .18s var(--ease); }
.modal-box {
    background: #fff; border-radius: var(--radius); padding: 16px 18px; width: 380px;
    max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: fadeIn .2s var(--ease);
}
.modal-box h3 { margin: 0 0 10px; font-size: 1.05rem; color: var(--brand-darker); }
.option-group { margin-bottom: 12px; }
.option-group > label.group-label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); font-weight: 700; display: block; margin-bottom: 6px;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1.5px solid var(--border); border-radius: 16px;
    padding: 5px 11px; font-size: .8rem; cursor: pointer; user-select: none;
    background: #fff; line-height: 1.2; transition: all .15s var(--ease);
}
.pill input { margin: 0; accent-color: var(--brand); }
.pill.selected { border-color: var(--brand); background: var(--brand-wash); color: var(--brand); font-weight: 600; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.check-item {
    display: flex; align-items: center; gap: 6px;
    font-size: .78rem; padding: 4px 0; line-height: 1.2; cursor: pointer;
}
.check-item input { margin: 0; flex-shrink: 0; accent-color: var(--brand); }
.qty-stepper { display: flex; align-items: center; gap: 10px; }
.qty-stepper button {
    width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--border);
    background: #fff; cursor: pointer; font-size: 1rem; transition: all .15s var(--ease);
}
.qty-stepper button:hover { border-color: var(--brand); color: var(--brand); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* Receipt */
.receipt { max-width: 380px; margin: 0 auto; font-family: 'Courier New', monospace; font-size: .85rem; }
.receipt h2 { text-align: center; }
.receipt hr { border: none; border-top: 1px dashed #999; }
.receipt table td { border: none; padding: 2px 0; }
.receipt-logo { display: block; margin: 0 auto 6px; height: 46px; width: 46px; object-fit: contain; }

/* Production slip */
.production-slip .station-heading { margin: 10px 0 6px; text-align: center; letter-spacing: 1px; }
.production-slip .category-label {
    font-weight: 700; text-transform: uppercase; font-size: .78rem;
    color: var(--muted); border-bottom: 1px dashed #ccc; margin: 8px 0 2px; padding-bottom: 2px;
}
.production-slip .qty-col { width: 34px; vertical-align: top; font-weight: 700; }
.production-slip .sub-item { padding-left: 10px; color: var(--muted); font-size: .82rem; }
.order-type-tag {
    display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase;
    padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: middle;
}
.tag-dinein  { background: #e9f3ea; color: var(--success); }
.tag-takeout { background: #fdecd2; color: #a15c00; }

@media print {
    .no-print { display: none !important; }
    .topbar, .footer { display: none !important; }
}

@media (max-width: 900px) {
    .pos-layout { grid-template-columns: 1fr; }
    .cart-panel { position: static; }
}
