/* =====================================================================
   PORKOODAM - Fashion Jewellers
   Premium enterprise UI theme
   ===================================================================== */

:root {
    --gold-900: #6b4f16;
    --gold-700: #9a7b28;
    --gold-500: #c9a24b;
    --gold-400: #d8b968;
    --gold-200: #efe0b8;
    --ink-900: #1c1a17;
    --ink-800: #262320;
    --ink-700: #34302b;
    --ink-500: #6d665c;
    --cream: #faf7f0;
    --cream-2: #f3ecdd;
    --white: #ffffff;
    --line: #e7ddc7;
    --danger: #b23b3b;
    --danger-bg: #fbeaea;
    --success: #2f7d4f;
    --success-bg: #e8f5ec;
    --warn: #a9791d;
    --warn-bg: #fbf1d9;
    --info: #2f5f7d;
    --info-bg: #e7f0f5;
    --shadow-sm: 0 1px 3px rgba(28, 26, 23, .08);
    --shadow-md: 0 6px 20px rgba(28, 26, 23, .12);
    --shadow-lg: 0 18px 46px rgba(28, 26, 23, .18);
    --radius: 14px;
    --radius-sm: 9px;
    --sidebar-w: 264px;
    --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-body: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--ink-900);
    background: var(--cream);
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3, h4, .brand-name { font-family: var(--font-head); font-weight: 700; letter-spacing: .3px; }

a { color: var(--gold-700); text-decoration: none; }
a:hover { color: var(--gold-900); }

/* ---------- Auth / Login ---------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(201,162,75,.28), transparent 55%),
        radial-gradient(900px 500px at 110% 120%, rgba(107,79,22,.35), transparent 50%),
        linear-gradient(160deg, var(--ink-900), var(--ink-700));
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 34px;
    border-top: 5px solid var(--gold-500);
}
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo .brand-name { font-size: 34px; color: var(--gold-700); margin: 0; }
.auth-logo .brand-tag { color: var(--ink-500); letter-spacing: 3px; text-transform: uppercase; font-size: 11px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--ink-900), var(--ink-800));
    color: var(--cream);
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}
.sidebar-brand { padding: 22px 22px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .brand-name { font-size: 26px; color: var(--gold-400); margin: 0; }
.sidebar-brand .brand-tag { font-size: 10.5px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold-200); opacity: .8; }
.sidebar-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(239,224,184,.55); padding: 14px 12px 6px; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 13px; border-radius: 10px;
    color: rgba(250,247,240,.82); font-size: 14px; font-weight: 500;
    margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(201,162,75,.14); color: var(--white); }
.nav-item.active { background: linear-gradient(90deg, rgba(201,162,75,.28), rgba(201,162,75,.05)); color: var(--gold-200); box-shadow: inset 3px 0 0 var(--gold-500); }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 66px; background: var(--white); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 26px; position: sticky; top: 0; z-index: 30; box-shadow: var(--shadow-sm);
}
.topbar-title { font-family: var(--font-head); font-size: 20px; color: var(--ink-900); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-500), var(--gold-900)); color: #fff; display: grid; place-items: center; font-weight: 600; }
.user-meta { line-height: 1.2; }
.user-meta .name { font-weight: 600; font-size: 13.5px; }
.user-meta .role { font-size: 11.5px; color: var(--ink-500); }
.badge-branch { background: var(--gold-200); color: var(--gold-900); padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }

.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-800); }

.content { padding: 26px; flex: 1; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.page-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0 0 3px; }
.page-head .subtitle { color: var(--ink-500); font-size: 13.5px; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 22px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16.5px; }
.card-body { padding: 20px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-200), transparent); }
.stat-card .label { font-size: 12.5px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .6px; }
.stat-card .value { font-family: var(--font-head); font-size: 30px; color: var(--gold-900); margin-top: 6px; }
.stat-card .hint { font-size: 12px; color: var(--ink-500); margin-top: 4px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--ink-700); }
.form-group label .req { color: var(--danger); }
.form-control, select.form-control, textarea.form-control {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; background: var(--white); color: var(--ink-900); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201,162,75,.18); }
.form-control:disabled, .form-control[readonly] { background: var(--cream-2); color: var(--ink-500); }
.form-hint { font-size: 12px; color: var(--ink-500); }
.field-error { font-size: 12px; color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 72px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--gold-500), var(--gold-700)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); color: #fff; }
.btn-secondary { background: var(--white); color: var(--ink-800); border-color: var(--line); }
.btn-secondary:hover { background: var(--cream-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--gold-700); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th { background: var(--cream-2); color: var(--ink-700); text-align: left; padding: 11px 13px; font-weight: 600; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.data tbody td { padding: 10px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: var(--cream); }
table.data tfoot td { padding: 12px 13px; font-weight: 700; background: var(--cream-2); border-top: 2px solid var(--gold-200); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-body); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .2px; line-height: 1.45; }
.cell-data { font-family: var(--font-body); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .2px; line-height: 1.45; color: var(--ink-800); }
.cell-amount { font-family: var(--font-body); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .2px; line-height: 1.45; color: var(--ink-900); }
.th-pad-right { padding-left: 22px !important; }
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: nowrap; white-space: nowrap; max-width: 100%; }
.row-actions .btn { flex-shrink: 0; }
.inline-form { display: inline-flex; margin: 0; padding: 0; vertical-align: middle; }
table.data .col-actions { width: 1%; white-space: nowrap; vertical-align: middle; }
table.data td.col-actions { padding-left: 8px; padding-right: 8px; }
@media (max-width: 720px) {
    .row-actions { gap: 4px; }
    .row-actions .btn-sm { padding: 5px 8px; font-size: 11px; }
    table.data td.col-actions { padding-left: 6px; padding-right: 6px; }
}

/* ---------- Confirm modal ---------- */
.pk-modal-backdrop { position: fixed; inset: 0; background: rgba(28, 26, 23, .45); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.pk-modal-backdrop.show { display: flex; }
.pk-modal { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: 420px; width: 100%; padding: 26px 24px 20px; border: 1px solid var(--line); }
.pk-modal h3 { margin: 0 0 10px; font-size: 18px; color: var(--ink-900); }
.pk-modal p { margin: 0 0 14px; font-size: 14px; color: var(--ink-500); line-height: 1.55; }
.pk-modal .pk-password-wrap { margin-bottom: 18px; display: none; }
.pk-modal .pk-password-wrap.show { display: block; }
.pk-modal .pk-password-wrap label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
.pk-modal .pk-password-wrap input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; }
.pk-modal .pk-password-wrap input:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201,162,75,.18); }
.pk-modal .pk-password-hint { font-size: 12px; color: var(--ink-500); margin-top: 6px; }
.pk-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Badges / status ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-muted { background: var(--cream-2); color: var(--ink-500); }

/* ---------- Alerts / flash ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bfe3cb; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #f0c9c9; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #c7dded; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #ecd7a3; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--ink-500); }
.empty .ico { font-size: 40px; opacity: .5; }

/* ---------- Utilities ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.divider-cut { border: none; border-top: 2px dashed var(--ink-500); margin: 26px 0; position: relative; }
.divider-cut::before { content: "\2702  cut here"; position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--white); padding: 0 12px; color: var(--ink-500); font-size: 11.5px; letter-spacing: 1px; }
.summary-box { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary-row.total { border-top: 2px solid var(--gold-200); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 16px; color: var(--gold-900); }
.link-muted { color: var(--ink-500); }
.hide { display: none !important; }
.search-input { min-width: 0; flex: 1 1 200px; max-width: 100%; }

/* ---------- Print / invoice ---------- */
.invoice { background: #fff; max-width: 820px; margin: 0 auto; padding: 34px; border: 1px solid var(--line); }
.invoice-header { text-align: center; border-bottom: 3px double var(--gold-500); padding-bottom: 14px; margin-bottom: 18px; }
.invoice-header .brand-name { font-size: 38px; color: var(--gold-700); margin: 0; }
.invoice-header .brand-sub { letter-spacing: 2px; color: var(--ink-500); font-size: 12px; text-transform: uppercase; }
.invoice-header .contact { font-size: 12px; color: var(--ink-700); margin-top: 6px; }
.invoice-title { text-align: center; font-family: var(--font-head); font-size: 22px; letter-spacing: 3px; margin: 16px 0; }
.invoice-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; font-size: 13.5px; }
.sign-area { margin-top: 40px; display: flex; justify-content: flex-end; }
.sign-box { text-align: center; border-top: 1px solid var(--ink-700); padding-top: 6px; min-width: 220px; font-size: 13px; }

@media print {
    .sidebar, .topbar, .no-print, .toolbar { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    body { background: #fff; }
    .invoice { border: none; }
}

/* ---------- Responsive ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 992px) {
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .hamburger { display: block; }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
    .user-meta { display: none; }
    .topbar { padding: 0 16px; height: auto; min-height: 66px; flex-wrap: wrap; gap: 10px; }
    .topbar-right { gap: 10px; flex-wrap: wrap; }
    .badge-branch { font-size: 10.5px; padding: 3px 8px; }
}
@media (max-width: 560px) {
    .content { padding: 16px; }
    .page-head { flex-direction: column; align-items: stretch; }
    .page-head h1 { font-size: 22px; }
    .page-head > .btn { width: 100%; justify-content: center; }
    .page-head-actions { width: 100%; }
    .page-head-actions .btn { flex: 1; justify-content: center; }
    .card-body { padding: 16px; }
    .card-head { flex-wrap: wrap; gap: 10px; }
    .toolbar .btn { flex: 1 1 auto; justify-content: center; }
    .toolbar .search-input { flex: 1 1 100%; }
    table.data { font-size: 12.5px; }
    table.data thead th,
    table.data tbody td { padding: 8px 10px; }
    .form-grid { grid-template-columns: 1fr; }
    #itemsTable select.product-code { min-width: 160px; }
}
