:root {
  --ink: #172118;
  --muted: #748076;
  --line: #e7ebe7;
  --bg: #f5f7f4;
  --panel: #fff;
  --green: #1f6d45;
  --green-dark: #164d32;
  --green-pale: #eaf3ed;
  --amber: #bd7a1b;
  --amber-pale: #fff3dc;
  --red: #c34b3e;
  --red-pale: #fff0ed;
  --blue: #4179a8;
  --blue-pale: #eaf2f8;
  --shadow: 0 12px 35px rgba(24, 43, 31, .06);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "DM Sans", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand strong { font-family: Manrope, sans-serif; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-visual { padding: clamp(42px, 7vw, 92px); color: #fff; background: radial-gradient(circle at 80% 10%, rgba(151, 187, 126, .2), transparent 35%), linear-gradient(145deg, #162419, #244830); display: flex; flex-direction: column; justify-content: space-between; }
.login-visual h1 { font-size: clamp(38px, 5vw, 72px); letter-spacing: -.055em; line-height: 1.04; margin: 25px 0; }
.login-copy { color: #cbd8cf; max-width: 590px; font-size: 18px; line-height: 1.7; }
.login-feature-row { display: flex; flex-wrap: wrap; gap: 25px; color: #d8e5dc; }
.login-feature-row span::first-letter { color: #78aa83; }
.login-panel { display: grid; place-items: center; padding: 40px; background: #fafbf9; }
.login-card { width: min(420px, 100%); }
.login-card h2 { font-size: 34px; margin-bottom: 8px; letter-spacing: -.035em; }
.login-card > .muted { margin-bottom: 35px; }
.eyebrow { font-size: 11px; letter-spacing: .18em; font-weight: 800; color: var(--green); margin-bottom: 10px; }
.eyebrow.light { color: #9bc2a5; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--green); color: #fff; font: 800 19px Manrope; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.brand-mark.large { width: 58px; height: 58px; background: rgba(255,255,255,.12); font-size: 27px; }
.mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 38px; font-family: Manrope; }
label { display: grid; gap: 8px; color: #3d493f; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #dfe4df; background: #fff; color: var(--ink); border-radius: 11px; padding: 12px 13px; outline: none; transition: .2s; }
input:focus, select:focus, textarea:focus { border-color: #6e9e7d; box-shadow: 0 0 0 3px rgba(46, 112, 69, .11); }
input[readonly] { color: #667068; background: #f1f3f1; cursor: not-allowed; }
.login-card label { margin-bottom: 19px; }
.primary, .secondary { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; display: inline-flex; justify-content: center; align-items: center; gap: 9px; }
.primary { color: #fff; background: var(--green); box-shadow: 0 6px 15px rgba(25, 95, 58, .16); }
.primary:hover { background: var(--green-dark); }
.secondary { color: #3d493f; background: #eef1ee; }
.full { width: 100%; margin-top: 8px; padding: 14px 17px; justify-content: space-between; }
.demo-note { font-size: 12px; color: #8a938b; text-align: center; margin: 18px 0 0; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 250px; padding: 29px 18px 20px; display: flex; flex-direction: column; background: #17251b; color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 32px; }
.brand > div:last-child { display: grid; }
.brand strong { font-size: 18px; }
.brand span { color: #839389; font-size: 11px; margin-top: 2px; }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; color: #9da9a0; border-radius: 9px; padding: 12px 13px; text-align: left; font-size: 13px; font-weight: 600; }
.nav-item > span { width: 18px; text-align: center; font-size: 18px; }
.nav-item:hover, .nav-item.active { background: #24412d; color: #fff; }
.nav-item b { margin-left: auto; background: #d9a054; color: #152219; border-radius: 12px; padding: 2px 7px; font-size: 10px; }
.sidebar-help { margin-top: auto; display: flex; gap: 10px; padding: 12px; background: #203a29; border-radius: 10px; color: #c9d4cc; }
.sidebar-help > span { width: 27px; height: 27px; border: 1px solid #587363; border-radius: 50%; display: grid; place-items: center; }
.sidebar-help div { display: grid; font-size: 10px; }
.sidebar-help small { color: #829488; margin-top: 3px; }
.user-card { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 14px 8px 0; border-top: 1px solid #2a3c2e; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #d8e1da; color: #23402c; font-weight: 800; }
.user-card > div:nth-child(2) { display: grid; font-size: 11px; }
.user-card span { color: #7f9084; margin-top: 2px; }
.user-card button { margin-left: auto; border: 0; background: transparent; color: #9cab9f; font-size: 19px; }

.main { margin-left: 250px; min-height: 100vh; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(22px, 4vw, 55px); background: rgba(255,255,255,.91); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.topbar p { color: #89928b; font-size: 11px; margin-bottom: 2px; }
.topbar h2 { font-size: 18px; margin: 0; }
.menu-button { display: none !important; }
.page { display: none; padding: 36px clamp(22px, 4vw, 55px) 60px; }
.page.active { display: block; }
.welcome-row h3 { font-size: 22px; margin-bottom: 5px; }
.welcome-row p { font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; margin: 26px 0; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 21px; display: flex; align-items: center; gap: 15px; box-shadow: var(--shadow); }
.metric-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; font-size: 17px; font-weight: 800; }
.metric-icon.green { color: var(--green); background: var(--green-pale); }
.metric-icon.amber { color: var(--amber); background: var(--amber-pale); }
.metric-icon.red { color: var(--red); background: var(--red-pale); }
.metric-icon.blue { color: var(--blue); background: var(--blue-pale); }
.metric > div:last-child { display: grid; }
.metric span { color: #7d867f; font-size: 11px; }
.metric strong { font: 800 22px Manrope; margin: 4px 0 2px; }
.metric small { color: #a1a7a2; font-size: 9px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, .8fr); gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); overflow: hidden; }
.panel-title { display: flex; align-items: center; justify-content: space-between; padding: 21px 23px 15px; }
.panel-title h3, .section-heading h3 { font-size: 15px; margin-bottom: 3px; }
.panel-title p, .section-heading p { color: #919992; font-size: 10px; margin: 0; }
.text-button { border: 0; color: var(--green); background: transparent; font-size: 11px; font-weight: 700; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; background: #fff; color: var(--green); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 18px; color: #949b95; background: #f9faf9; font-size: 9px; text-align: left; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
td { padding: 15px 18px; border-top: 1px solid #eef0ee; font-size: 11px; vertical-align: middle; }
td strong { display: block; color: #29332b; }
td small { color: #929a94; }
.status { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 12px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status.bekliyor { color: #a36a1a; background: #fff3dc; }
.status.hazirlaniyor { color: #37719f; background: #e9f2f8; }
.status.teslim { color: #247148; background: #e9f4ed; }
.empty-cell { text-align: center; color: #98a099; padding: 35px; }
.stock-list { padding: 3px 23px 23px; display: grid; gap: 19px; }
.stock-row-top { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.stock-row-top b { color: #303a32; }
.stock-row-top span { color: #7b857d; }
.progress { height: 6px; background: #edf0ed; border-radius: 10px; overflow: hidden; margin-top: 7px; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.progress.low span { background: #d18b2c; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.section-actions { display: flex; align-items: center; gap: 10px; }
.section-heading h3 { font-size: 21px; }
.search { display: flex; align-items: center; min-width: 300px; position: relative; }
.search span { position: absolute; left: 12px; color: #8d958f; }
.search input { padding-left: 34px; background: #fff; }
#ordersPage .panel td { font-size: 12px; }
.row-action { border: 1px solid #dfe5df; background: #fff; color: var(--green); border-radius: 7px; padding: 6px 9px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-action.quick { color: #fff; background: var(--green); border-color: var(--green); }
.row-action.danger { color: var(--red); border-color: #efd5d1; }
.customer-grid, .product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.customer-card, .product-card { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 20px; box-shadow: var(--shadow); }
.customer-card-head, .product-card-head { display: flex; gap: 12px; align-items: center; }
.customer-card-head .row-action { margin-left: auto; }
.customer-card h4, .product-card h4 { margin: 0 0 3px; font: 700 14px Manrope; }
.customer-card p, .product-card p { margin: 0; color: var(--muted); font-size: 11px; }
.customer-stats { border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; padding-top: 15px; }
.customer-stats span, .product-details span { display: grid; gap: 4px; color: #939a94; font-size: 9px; }
.customer-stats b, .product-details b { color: #29332b; font-size: 13px; }
.customer-stats .has-debt b { color: var(--red); }
.customer-actions { display: flex; gap: 7px; margin-top: 14px; }
.customer-actions .row-action { flex: 1; }
.payment-debt-info { padding: 11px 13px; color: #875d20; background: var(--amber-pale); border-radius: 9px; font-size: 11px; font-weight: 700; }
.rate-badge { padding: 9px 12px; color: var(--green-dark); background: var(--green-pale); border: 1px solid #d2e3d6; border-radius: 9px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.product-card-head { justify-content: space-between; }
.coal-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: #edf2ee; font-size: 20px; }
.product-card .row-action { margin-left: auto; }
.product-card-head .row-actions { margin-left: auto; }
.product-card-head .row-actions .row-action { margin-left: 0; }
.product-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 13px; }
.product-details.three { grid-template-columns: repeat(3, 1fr); }

.dialog { width: min(700px, calc(100% - 30px)); border: 0; border-radius: 17px; padding: 0; box-shadow: 0 25px 80px rgba(18, 34, 23, .25); }
.dialog::backdrop { background: rgba(15, 25, 18, .58); backdrop-filter: blur(3px); }
.dialog form { padding: 28px; }
.small-dialog { width: min(460px, calc(100% - 30px)); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 24px; }
.dialog-head h2 { font-size: 22px; margin: 0; }
.dialog-close { border: 0; background: #f0f2f0; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; color: #59615a; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
textarea { resize: vertical; }
.order-total { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin: 22px 0 0; padding: 17px; border-radius: 11px; background: var(--green-pale); color: var(--green-dark); }
.order-total > div { display: grid; gap: 4px; }
.order-total > div:last-child { text-align: right; }
.order-total span { font-size: 10px; font-weight: 700; }
.order-total b { font-size: 13px; }
.order-total strong { font: 800 21px Manrope; }
.purchase-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; padding: 16px; background: var(--green-pale); border-radius: 11px; }
.purchase-summary span { display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.purchase-summary b, .purchase-summary strong { color: var(--green-dark); font-size: 14px; }
.report-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.report-actions select, .report-actions input { width: auto; min-width: 125px; }
.report-metrics { grid-template-columns: repeat(4, 1fr); }
.report-grid { grid-template-columns: minmax(0, 2fr) minmax(250px, .8fr); }
.report-series { display: grid; gap: 16px; padding: 5px 22px 24px; }
.report-series-row > div:first-child { display: flex; justify-content: space-between; gap: 10px; font-size: 9px; }
.report-series-row span { color: var(--muted); }
.profit-positive { color: var(--green); }
.profit-negative { color: var(--red); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-stack { display: grid; gap: 17px; }
.receipt-dialog { width: min(820px, calc(100% - 30px)); padding: 28px; }
.receipt-sheet { color: #172118; background: #fff; }
.receipt-brand, .receipt-brand > div, .receipt-meta, .receipt-bottom { display: flex; align-items: center; justify-content: space-between; }
.receipt-brand { padding-bottom: 22px; border-bottom: 2px solid #1f6d45; }
.receipt-brand > div { gap: 12px; }
.receipt-brand h2 { margin: 0; font-size: 21px; }
.receipt-brand p { margin: 2px 0 0; color: #758078; font-size: 10px; }
.receipt-logo { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--green); border-radius: 11px; font: 800 19px Manrope; }
.receipt-type { padding: 7px 10px; border: 1px solid #9fbaa7; border-radius: 5px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.receipt-meta { gap: 25px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.receipt-meta > div { display: grid; gap: 4px; }
.receipt-meta > div:last-child { text-align: right; }
.receipt-sheet small { color: #8c958e; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.receipt-meta strong { font-size: 12px; }
.receipt-customer { padding: 20px 0; }
.receipt-customer h3 { margin-bottom: 12px; font-size: 12px; }
.receipt-customer > div { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.receipt-customer span, .receipt-info span { display: grid; gap: 4px; }
.receipt-customer b, .receipt-info b { font-size: 11px; font-weight: 600; }
.receipt-wide { grid-column: span 2; }
.receipt-table { border: 1px solid var(--line); }
.receipt-table th { background: #eef4f0; color: #3e5545; }
.receipt-table td { font-size: 12px; }
.receipt-bottom { align-items: flex-start; gap: 30px; margin-top: 22px; }
.receipt-info { display: grid; gap: 13px; flex: 1; }
.receipt-totals { width: 260px; display: grid; gap: 9px; }
.receipt-totals span { display: flex; justify-content: space-between; gap: 20px; color: #687269; font-size: 11px; }
.receipt-totals b { color: #202a22; font-size: 12px; }
.receipt-debt { padding-top: 10px; border-top: 2px solid #263329; color: #202a22 !important; font-weight: 800; }
.receipt-debt b { color: var(--red); font-size: 15px; }
.payment-receipt-amount { display: flex; justify-content: space-between; align-items: center; margin: 22px 0; padding: 22px; color: var(--green-dark); background: var(--green-pale); border: 1px solid #cfe0d3; border-radius: 10px; }
.payment-receipt-amount span { font-size: 12px; font-weight: 700; }
.payment-receipt-amount strong { font: 800 26px Manrope; }
.receipt-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; margin: 55px 55px 30px; text-align: center; color: #5c665e; font-size: 10px; }
.receipt-signatures span { padding-top: 10px; border-top: 1px solid #aeb5af; }
.receipt-signatures i { display: block; color: #9ba29c; margin-top: 3px; }
.receipt-footer { margin: 0; padding-top: 13px; border-top: 1px solid var(--line); color: #929993; text-align: center; font-size: 9px; }
.receipt-actions { margin-bottom: 0; padding-top: 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; z-index: 100; right: 22px; top: 20px; max-width: 380px; transform: translateY(-150%); opacity: 0; transition: .25s; background: #1d3022; color: #fff; border-radius: 10px; padding: 13px 17px; box-shadow: 0 12px 35px rgba(0,0,0,.18); font-size: 12px; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #9d3f36; }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .customer-grid, .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 28px; }
  .mobile-brand { display: flex; }
  .sidebar { transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: translateX(0); box-shadow: 15px 0 35px rgba(0,0,0,.25); }
  .main { margin-left: 0; }
  .topbar { height: 76px; padding: 14px 17px; }
  .topbar > div { margin-right: auto; margin-left: 11px; }
  .topbar .primary { font-size: 0; width: 39px; height: 39px; padding: 0; }
  .topbar .primary span { font-size: 19px; }
  .menu-button { display: grid !important; }
  .page { padding: 25px 16px 50px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { padding: 15px; gap: 10px; }
  .metric-icon { display: none; }
  .metric strong { font-size: 17px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-actions { align-items: stretch; flex-direction: column; }
  .report-actions { align-items: stretch; flex-direction: column; }
  .report-actions select, .report-actions input { width: 100%; }
  .search { min-width: 0; width: 100%; }
  .customer-grid, .product-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .order-total, .purchase-summary { grid-template-columns: 1fr; }
  .order-total > div:last-child { text-align: left; }
  .product-details.three { grid-template-columns: 1fr; }
  .dialog form { padding: 22px 18px; }
  .receipt-dialog { padding: 20px; }
  .receipt-brand, .receipt-bottom { align-items: stretch; flex-direction: column; gap: 18px; }
  .receipt-type { align-self: flex-start; }
  .receipt-totals { width: 100%; }
  .row-actions { flex-wrap: wrap; min-width: 130px; }
}

@media print {
  @page { size: A4; margin: 16mm; }
  body { background: #fff; }
  body > * { display: none !important; }
  #receiptDialog { display: block !important; position: static; width: 100%; max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
  #receiptDialog::backdrop, .receipt-actions { display: none !important; }
  .receipt-sheet { display: block !important; }
  .receipt-brand, .receipt-bottom { flex-direction: row; }
  .receipt-totals { width: 260px; }
}
