@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700;800;900&display=swap");

:root {
  --blue: #3b31f4;
  --blue-dark: #261ec7;
  --cyan: #732fe8;
  --ink: #18233b;
  --muted: #73809a;
  --line: #e6eaf2;
  --surface: #ffffff;
  --background: #f4f4fc;
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(circle at 88% 0%, #dedcff 0, transparent 29rem), var(--background);
  font-feature-settings: "liga" 1, "clig" 1, "calt" 1, "locl" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font: inherit; }
.site-header { background: rgba(255, 255, 255, .88); border-bottom: 1px solid rgba(230, 234, 242, .88); backdrop-filter: blur(12px); }
.header-content { max-width: 1120px; min-height: 72px; padding: 0 24px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); font-weight: 900; font-size: 1.35rem; text-decoration: none; direction: ltr; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: 0 3px 10px rgba(59, 49, 244, .18), 0 0 0 2px #fff; }
.warehouse-link { border: 1px solid #dad8f6; background: #f7f7ff; color: var(--blue-dark); text-decoration: none; cursor: pointer; font-weight: 800; border-radius: 10px; padding: 9px 14px; }
.warehouse-link:hover { background: #ebeaff; }
.order-page { background: linear-gradient(145deg, #efeeff 0%, #f8f8ff 48%, #f1f0ff 100%); }.order-page .site-header { background: rgba(255,255,255,.7); border: 0; }.order-page .header-content { max-width: 780px; min-height: 78px; }.order-page .warehouse-link { background: #fff; border-color: #d8d6ff; box-shadow: 0 5px 15px rgba(59,49,244,.08); }.order-page .page-shell { max-width: 780px; padding-top: 34px; }.order-page .form-card { position: relative; max-width: 680px; padding: 42px; overflow: hidden; border: 0; border-radius: 30px; box-shadow: 0 22px 55px rgba(37, 69, 135, .16); }.order-page .form-card::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 7px; background: linear-gradient(90deg, #3b31f4, #7435e1); }.order-page .eyebrow { padding: 7px 13px; color: #2d24d5; background: #eeedff; font-size: .82rem; }.order-page h1 { color: #1a1754; font-size: 2.15rem; }.order-page .intro { max-width: 440px; margin-bottom: 27px; line-height: 1.9; }.order-page .field { margin-bottom: 16px; }.order-page label { color: #2a2767; font-size: .97rem; }.order-page input, .order-page textarea, .order-page select { border-color: #dddcf5; background: #fbfbff; border-radius: 14px; padding: 14px 15px; box-shadow: 0 2px 4px rgba(31, 62, 116, .02); }.order-page input:hover, .order-page textarea:hover, .order-page select:hover { border-color: #b1aeea; }.order-page input:focus, .order-page textarea:focus, .order-page select:focus { border-color: #3b31f4; box-shadow: 0 0 0 4px rgba(59,49,244,.12); }.order-page .price-result { margin: 2px 0 7px; gap: 12px; }.order-page .price-result div { background: linear-gradient(135deg, #f1f0ff, #f7f7ff); border-color: #d8d6ff; border-radius: 14px; }.order-page .primary-button { margin-top: 6px; padding: 15px 18px; border-radius: 14px; font-size: 1.04rem; background: linear-gradient(135deg, #3b31f4, #642ac9); }.order-page .form-message { font-size: .9rem; font-weight: 700; }
.order-page .form-section { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px dashed #dddcf5; }
.order-page .form-section:last-of-type { margin-bottom: 4px; padding-bottom: 0; border-bottom: 0; }
.order-page .form-section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: #231e8a; font-size: 1.05rem; font-weight: 900; }
.order-page .form-section-num { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(135deg, #3b31f4, #732fe8); color: #fff; font-size: .85rem; font-weight: 900; box-shadow: 0 4px 10px rgba(59,49,244,.28); }
.order-page .input-icon-wrap { position: relative; }
.order-page .input-icon-wrap input { padding-left: 42px !important; }
.order-page .field-icon { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); font-size: 1.05rem; opacity: .55; pointer-events: none; }
.order-page .price-result { align-items: stretch; }
.order-page .price-result .total-highlight { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: linear-gradient(135deg, #3b31f4, #642ac9) !important; border-color: transparent !important; }
.order-page .price-result .total-highlight span { color: rgba(255,255,255,.85); font-size: .85rem; font-weight: 700; }
.order-page .price-result .total-highlight strong { color: #fff; font-size: 1.35rem; }
.order-page .duplicate-notice { border-radius: 12px; }
.page-shell { max-width: 1120px; margin: 0 auto; padding: 52px 24px 72px; }
.form-card { max-width: 620px; margin: 0 auto; padding: 38px; background: var(--surface); border: 1px solid #eef1f7; border-radius: 24px; box-shadow: 0 18px 45px rgba(38, 58, 102, .11); }
.eyebrow { display: inline-flex; margin: 0 0 9px; padding: 5px 10px; color: var(--blue-dark); background: #ebeaff; border-radius: 999px; font-weight: 800; font-size: .78rem; }
h1 { margin: 0; font-size: 2rem; letter-spacing: -.03em; }
.intro { margin: 10px 0 30px; color: var(--muted); }
.field { margin-bottom: 19px; }
label { display: block; margin-bottom: 8px; color: #33415e; font-weight: 800; font-size: .94rem; }
label span { color: #dc2626; }
input, textarea, select { width: 100%; border: 1px solid #d9dfeb; border-radius: 12px; padding: 13px 14px; color: var(--ink); background: #fbfbff; outline: none; transition: .18s ease; }
input::placeholder, textarea::placeholder { color: #a6b0c1; }
input:hover, textarea:hover, select:hover { border-color: #bbb9e6; background: #fff; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(59, 49, 244, .12); }
textarea { resize: vertical; }
.products-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.product-input-row { display: flex; align-items: center; gap: 8px; }
.product-input-row input { flex: 1; }
.remove-product-btn { padding: 10px 14px; background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: .9rem; transition: .18s ease; flex-shrink: 0; }
.remove-product-btn:hover { background: #ffe4e6; color: #9f1239; }
.add-product-button { display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; background: #f0efff; color: #261dd8; border: 1px solid #c2bffe; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: .86rem; transition: .18s ease; margin-top: 4px; }
.add-product-button:hover { background: #dddbfe; border-color: #9893fd; }
.primary-button, .secondary-button { border: 0; border-radius: 12px; padding: 13px 18px; cursor: pointer; font-weight: 900; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.primary-button { width: 100%; background: linear-gradient(135deg, #4339ff, #3128d9); color: #fff; box-shadow: 0 10px 20px rgba(59, 49, 244, .25); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); box-shadow: 0 13px 25px rgba(59, 49, 244, .32); }
.primary-button:disabled { opacity: .65; cursor: wait; }
.secondary-button { background: #efeeff; color: var(--blue-dark); }
.secondary-button:hover { background: #e1dfff; transform: translateY(-1px); }
.form-message { min-height: 24px; margin: 14px 0 0; color: var(--muted); }
.form-message.success { color: #15803d; }
.form-message.error { color: #b91c1c; }
.price-result { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: -2px 0 3px; }.price-result div { padding: 12px; background: #f4f3ff; border: 1px solid #dedcfb; border-radius: 12px; }.price-result span, .price-result label { display: block; margin: 0; color: #63718c; font-size: .8rem; font-weight: 700; }.price-result input { margin-top: 5px; padding: 8px 9px; border-radius: 8px; background: #fff; }.price-result strong { display: block; margin-top: 9px; color: #231e8a; font-size: 1.02rem; }
.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dashboard-actions .secondary-button {
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 11px 19px;
  font-size: .92rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .05);
}
#accounting-toggle { background: #efeeff; color: #4338ca; border-color: #cac7fe; }
#accounting-toggle:hover { background: #e2e0ff; border-color: #a9a5fc; }
#archive-modal-btn { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
#archive-modal-btn:hover { background: #ffedd5; border-color: #fdba74; }
#refresh-button { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
#refresh-button:hover { background: #cffafe; border-color: #67e8f9; }
#notify-toggle { background: #fdf2f8; color: #be185d; border-color: #fbcfe8; }
#notify-toggle:hover { background: #fce7f3; border-color: #f9a8d4; }
#notify-toggle.notify-active { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
#notify-toggle.notify-active:hover { background: #d1fae5; border-color: #6ee7b7; }
#notify-toggle:disabled { opacity: .55; cursor: not-allowed; }
.warehouse-shell { max-width: 960px; margin: 0 auto; padding: 40px 20px 72px; }

/* Accounting Panel Redesign */
.accounting-panel { max-width: 100%; margin: 0 0 24px; padding: 26px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 24px; box-shadow: 0 10px 30px rgba(15, 23, 42, .06); }
.accounting-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.accounting-heading h2 { margin: 6px 0 4px; font-size: 1.45rem; color: #0f172a; font-weight: 900; }
.accounting-heading p { margin: 0; color: #64748b; font-size: .88rem; }
.period-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #f8fafc; padding: 10px 14px; border-radius: 14px; border: 1px solid #e2e8f0; }
.period-controls label { margin: 0; font-weight: 800; font-size: .88rem; color: #334155; }
.period-controls select { width: auto; padding: 8px 12px; border-radius: 10px; border: 1px solid #cbd5e1; font-weight: 700; background: #ffffff; color: #0f172a; cursor: pointer; }
.custom-date-inputs { display: flex; align-items: center; gap: 8px; background: #ffffff; padding: 6px 12px; border-radius: 12px; border: 1px solid #cbd5e1; flex-wrap: wrap; }
.custom-date-inputs label { margin: 0; font-size: .84rem; font-weight: 800; color: #334155; }
.custom-date-inputs input[type="date"] { width: auto; padding: 6px 10px; border-radius: 8px; border: 1px solid #94a3b8; font-weight: 700; font-size: .85rem; color: #0f172a; background: #ffffff; }
.reset-accounting-button { padding: 8px 14px; color: #be123c; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: .85rem; transition: .18s ease; }
.reset-accounting-button:hover { background: #ffe4e6; border-color: #fda4af; }

.accounting-summary { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }
.accounting-empty { padding: 22px; text-align: center; color: #64748b; font-weight: 700; font-size: .92rem; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 16px; }
.accounting-grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat-card { padding: 18px 20px; border-radius: 16px; border: 1px solid #e2e8f0; border-inline-start: 4px solid #cbd5e1; background: #ffffff; box-shadow: 0 4px 14px rgba(15, 23, 42, .04); display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-height: 96px; transition: transform .18s ease, box-shadow .18s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .06); }
.stat-card span { display: block; font-size: .85rem; font-weight: 800; color: #334155; }
.stat-card strong { display: block; }
.stat-card .stat-pill { align-self: flex-start; padding: 7px 16px; border-radius: 999px; font-size: 1.1rem; font-weight: 900; }

.stat-card.blue-card { border-inline-start-color: #2f25eb; }
.stat-card.blue-card .stat-pill { background: #f0efff; color: #231e8a; }

.stat-card.orange-card { border-inline-start-color: #c2410c; }
.stat-card.orange-card .stat-pill { background: #fff7ed; color: #7c2d12; }

.stat-card.dark-card { border-inline-start-color: #334155; }
.stat-card.dark-card .stat-pill { background: #f1f5f9; color: #0f172a; }

.stat-card.green-card { border-inline-start-color: #15803d; }
.stat-card.green-card .stat-pill { background: #f0fdf4; color: #14532d; }

.net-total-banner { padding: 18px 24px; border-radius: 16px; background: linear-gradient(135deg, #059669 0%, #10b981 100%); color: #ffffff; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 10px 25px rgba(16, 185, 129, .22); flex-wrap: wrap; gap: 10px; }
.net-total-banner span { font-size: 1rem; font-weight: 800; opacity: .95; }
.net-total-banner strong { font-size: 1.45rem; font-weight: 900; letter-spacing: 0.02em; }

.received-money-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 16px; padding: 20px; margin-bottom: 24px; }
.received-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.received-card-header h3 { margin: 0; font-size: 1rem; font-weight: 900; color: #1e293b; }
.received-money-form .form-row { display: flex; flex-direction: column; gap: 8px; }
.received-money-form label { margin: 0; font-size: .88rem; font-weight: 800; color: #475569; }
.input-btn-wrap { display: flex; gap: 10px; max-width: 480px; }
.input-btn-wrap input { flex: 1; padding: 11px 14px; border-radius: 12px; border: 1px solid #cbd5e1; font-weight: 700; background: #ffffff; }
.input-btn-wrap .primary-button { width: auto; padding: 11px 22px; white-space: nowrap; border-radius: 12px; font-size: .95rem; }

.accounting-cities { margin-top: 10px; }
.table-title { margin: 0 0 14px; font-size: 1.05rem; font-weight: 900; color: #0f172a; }
.accounting-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 4px 12px rgba(0, 0, 0, .02); }
.accounting-table { width: 100%; min-width: 600px; border-collapse: collapse; background: #ffffff; text-align: right; }
.accounting-table th { padding: 13px 16px; background: #f1f5f9; color: #334155; font-size: .88rem; font-weight: 800; border-bottom: 1px solid #e2e8f0; }
.accounting-table td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; font-size: .9rem; color: #1e293b; font-weight: 700; }
.accounting-table tbody tr:hover { background: #f8fafc; }
.accounting-table tfoot th { padding: 14px 16px; background: #f8fafc; color: #0f172a; font-weight: 900; font-size: .92rem; border-top: 2px solid #e2e8f0; }
.accounting-table tbody td:not(:first-child), .accounting-table tfoot th:not(:first-child) { text-align: center; }
.orders-stats-card {
  margin-bottom: 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .04);
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.orders-stats-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  text-align: center;
}
.orders-stats-table th {
  padding: 13px 16px;
  background: #f8fafc;
  color: #475569;
  font-size: .88rem;
  font-weight: 800;
  border-bottom: 1px solid #e2e8f0;
}
.orders-stats-table td {
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 900;
  color: #0f172a;
}
.badge-new {
  display: inline-block;
  padding: 6px 14px;
  background: #fff1f2;
  color: #be123c;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 800;
  border: 1px solid #fecdd3;
}
.badge-preparing {
  display: inline-block;
  padding: 6px 14px;
  background: #ecfdf5;
  color: #047857;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 800;
  border: 1px solid #a7f3d0;
}
.badge-returned {
  display: inline-block;
  padding: 6px 14px;
  background: #fff7ed;
  color: #c2410c;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 800;
  border: 1px solid #fed7aa;
}

.login-card { position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 6px; background: linear-gradient(90deg, #3b31f4, #7435e1); }
.login-card .eyebrow { display: inline-block; }

.dashboard-actions .secondary-button { display: inline-flex; align-items: center; gap: 6px; }

.orders-stats-table td:nth-child(1) { border-inline-start: 4px solid #64748b; }
.orders-stats-table td:nth-child(2) { border-inline-start: 4px solid #be123c; }
.orders-stats-table td:nth-child(3) { border-inline-start: 4px solid #047857; }
.orders-stats-table td:nth-child(4) { border-inline-start: 4px solid #c2410c; }
.orders-stats-table tbody tr:hover td { background: #f8fafc; }

.filters { display: grid; grid-template-columns: 1fr 195px; gap: 12px; padding: 14px; margin-bottom: 14px; background: rgba(255, 255, 255, .78); border: 1px solid #e9edf5; border-radius: 16px; }
.filters input, .filters select { transition: border-color .18s ease, box-shadow .18s ease; }
.filters input:focus, .filters select:focus { border-color: #3b31f4; box-shadow: 0 0 0 4px rgba(59,49,244,.12); }
.orders-list { display: grid; grid-template-columns: 1fr; gap: 12px; max-width: 100%; }
.order-card { position: relative; overflow: hidden; padding: 17px 19px; background: var(--surface); border: 1px solid #e7ebf3; border-radius: 15px; box-shadow: 0 6px 16px rgba(45, 62, 98, .05); }
.order-card::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 4px; background: #64748b; }
.order-top { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0 15px; border-bottom: 1px solid var(--line); }
.order-top strong { font-size: 1.12rem; }.order-top span { color: var(--muted); font-size: .83rem; }
.order-grid { display: grid; grid-template-columns: 1fr; gap: 0; margin: 10px 0; }
.order-grid p { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; margin: 0; color: #26344e; font-size: .94rem; border-bottom: 1px solid rgba(43, 58, 83, .12); }
.customer-profile-link {
  color: #2f25eb;
  text-decoration: none;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0efff;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #c2bffe;
  transition: .18s ease;
}
.customer-profile-link:hover {
  background: #dddbfe;
  color: #261dd8;
  text-decoration: underline;
}
.whatsapp-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  padding: 3px 8px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 800;
  text-decoration: none;
  transition: .18s ease;
}
.whatsapp-chat-btn:hover {
  background: #bbf7d0;
  color: #166534;
}
.product-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #f0efff;
  color: #261dd8;
  border: 1px solid #dddbfe;
  border-radius: 8px;
  font-size: .83rem;
  font-weight: 800;
  margin: 2px 2px 2px 0;
}
.duplicate-notice .product-badge {
  background: #ffffff;
  color: #231e8a;
  border-color: #cbd5e1;
}

.duplicate-notice {
  margin-top: 8px;
  padding: 10px 14px;
  background: #f0efff;
  border: 1px solid #c2bffe;
  color: #251eaf;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  direction: rtl;
  text-align: right;
}
.duplicate-notice.warning-returned {
  background: #fff7ed;
  border-color: #ffedd5;
  color: #c2410c;
}
.order-note { margin: 11px 0; font-size: .93rem; color: #26344e; }
.order-grid b, .order-note b { color: #4e5d76; }
.order-note { padding: 9px 10px; margin-bottom: 11px; background: rgba(255,255,255,.52); border-radius: 9px; }
.status-select {
  width: auto;
  min-width: 145px;
  padding: 9px 12px;
  font-weight: 800;
  border: 1px solid currentColor;
  color: #172033;
  box-shadow: none;
  cursor: pointer;
}
.status-select:focus { outline: 3px solid rgba(47, 37, 235, .24); outline-offset: 2px; }
.status-select option { color: #172033; background: #fff; font-weight: 700; }

.order-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.print-order-button { border: 0; border-radius: 10px; padding: 9px 12px; background: #27364f; color: #fff; cursor: pointer; font-weight: 800; }
.print-order-button:hover { background: #18233b; }
.delete-order-button { border: 0; border-radius: 10px; padding: 9px 12px; background: #fee2e2; color: #b91c1c; cursor: pointer; font-weight: 800; }
.delete-order-button:hover { background: #fecaca; }
.delete-order-button:disabled { opacity: .6; cursor: wait; }
.edit-order-button { border: 0; border-radius: 10px; padding: 9px 12px; background: #e2e0ff; color: #3730a3; cursor: pointer; font-weight: 800; transition: .18s ease; }
.edit-order-button:hover { background: #cac7fe; }
.restore-order-button { border: 0; border-radius: 10px; padding: 9px 12px; background: #dcfce7; color: #15803d; cursor: pointer; font-weight: 800; transition: .18s ease; }
.restore-order-button:hover { background: #bbf7d0; }

.archive-view-banner {
  background: #fef3c7;
  border: 1px solid #fde047;
  color: #854d0e;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
}
.archive-view-banner button {
  background: #854d0e;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 800;
  transition: .18s ease;
}
.archive-view-banner button:hover {
  background: #713f12;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
}
.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: #0f172a;
}
.close-modal-btn {
  background: #f1f5f9;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 900;
  color: #64748b;
  display: grid;
  place-items: center;
}
.close-modal-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.modal-actions button {
  flex: 1;
}

.status-new { background: #fee2e2; color: #991b1b; }
.status-preparing { background: #dcfce7; color: #166534; }
.status-returned { background: #ffedd5; color: #c2410c; }

/* ڕەنگی تەواوی کارت بە پێی دۆخی داواکاری */
.order-new { background: #fff1f2; border-color: #fecdd3; }
.order-new::before { background: #dc2626; }
.order-preparing { background: #ecfdf3; border-color: #bbf7d0; }
.order-preparing::before { background: #16a34a; }
.order-returned { background: #fff7ed; border-color: #fed7aa; }
.order-returned::before { background: #ea580c; }
.empty-state { padding: 34px; text-align: center; color: var(--muted); background: var(--surface); border-radius: 16px; border: 1px dashed #cfd7e8; }
.hidden { display: none !important; }

.header-nav { display: flex; align-items: center; gap: 10px; }
.theme-toggle-btn {
  border: 1px solid #dad8f6;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: .18s ease;
}
.theme-toggle-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.theme-modal-card h3 {
  margin: 0 0 12px;
  font-size: .95rem;
  font-weight: 900;
  color: var(--ink);
}
.color-swatches {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.swatch-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.swatch-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 15px rgba(0, 0, 0, .25);
}
.mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-btn {
  padding: 12px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: .18s ease;
  text-align: center;
}
.mode-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

/* Dark Mode theme overrides */
body.theme-dark {
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #334155;
  --surface: #1e293b;
  --background: #0f172a;
  --bg-gradient: radial-gradient(circle at 88% 0%, #1e293b 0, transparent 29rem), #0f172a;
}
body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
  background: #0f172a;
  color: #f8fafc;
  border-color: #334155;
}
body.theme-dark .site-header {
  background: rgba(30, 41, 59, .88);
  border-bottom-color: #334155;
}
body.theme-dark .order-card,
body.theme-dark .form-card,
body.theme-dark .accounting-panel,
body.theme-dark .orders-stats-card,
body.theme-dark .received-money-card,
body.theme-dark .modal-card {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}
body.theme-dark .accounting-table { background: #1e293b; color: #f8fafc; }
body.theme-dark .accounting-table th { background: #0f172a; color: #cbd5e1; border-bottom-color: #334155; }
body.theme-dark .accounting-table td { border-bottom-color: #334155; color: #f8fafc; }
body.theme-dark .accounting-table tfoot th { background: #0f172a; color: #f8fafc; border-top-color: #334155; }
body.theme-dark .period-controls,
body.theme-dark .custom-date-inputs { background: #0f172a; border-color: #334155; }
body.theme-dark .stat-card { border-color: #334155; }
body.theme-dark .accounting-empty { background: #0f172a; border-color: #334155; color: #94a3b8; }
body.theme-dark .mode-btn { background: #0f172a; color: #f8fafc; border-color: #334155; }
body.theme-dark .mode-btn:hover { background: #334155; }
body.theme-dark .theme-toggle-btn { background: #1e293b; color: #f8fafc; border-color: #334155; }
body.theme-dark .brand { color: #f8fafc; }

/* Dark Mode text-readability fixes: these elements sit directly on a
   card/panel background that turns dark above, but had their own literal
   (non-variable) text color, so they stayed dark-on-dark. Force them light. */
body.theme-dark.order-page h1,
body.theme-dark.order-page .form-section-title,
body.theme-dark .order-grid p,
body.theme-dark .received-card-header h3,
body.theme-dark .accounting-heading h2,
body.theme-dark .table-title {
  color: #f8fafc;
}
body.theme-dark.order-page label,
body.theme-dark .period-controls label,
body.theme-dark .custom-date-inputs label,
body.theme-dark .received-money-form label,
body.theme-dark .order-grid b,
body.theme-dark .order-note b {
  color: #cbd5e1;
}
body.theme-dark .accounting-heading p {
  color: #94a3b8;
}
body.theme-dark .order-note {
  background: rgba(255, 255, 255, .06);
  color: #f1f5f9;
}

/* Soft Gray theme overrides */
body.theme-soft {
  --background: #e5e7eb;
  --bg-gradient: #e5e7eb;
}

/* Deep Night Blue theme overrides */
body.theme-night {
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: #1e293b;
  --surface: #0f172a;
  --background: #020617;
  --bg-gradient: radial-gradient(circle at 88% 0%, #1e1b4b 0, transparent 35rem), #020617;
}
body.theme-night input,
body.theme-night textarea,
body.theme-night select {
  background: #020617;
  color: #f1f5f9;
  border-color: #1e293b;
}
body.theme-night .site-header {
  background: rgba(15, 23, 42, .88);
  border-bottom-color: #1e293b;
}
body.theme-night .order-card,
body.theme-night .form-card,
body.theme-night .accounting-panel,
body.theme-night .orders-stats-card,
body.theme-night .received-money-card,
body.theme-night .modal-card {
  background: #0f172a;
  border-color: #1e293b;
  color: #f1f5f9;
}
body.theme-night .accounting-table { background: #0f172a; color: #f1f5f9; }
body.theme-night .accounting-table th { background: #020617; color: #94a3b8; border-bottom-color: #1e293b; }
body.theme-night .accounting-table td { border-bottom-color: #1e293b; color: #f1f5f9; }
body.theme-night .accounting-table tfoot th { background: #020617; color: #f1f5f9; border-top-color: #1e293b; }
body.theme-night .period-controls,
body.theme-night .custom-date-inputs { background: #020617; border-color: #1e293b; }
body.theme-night .stat-card { border-color: #1e293b; }
body.theme-night .accounting-empty { background: #020617; border-color: #1e293b; color: #94a3b8; }
body.theme-night .mode-btn { background: #020617; color: #f1f5f9; border-color: #1e293b; }
body.theme-night .mode-btn:hover { background: #1e293b; }
body.theme-night .theme-toggle-btn { background: #0f172a; color: #f1f5f9; border-color: #1e293b; }
body.theme-night .brand { color: #f1f5f9; }

/* Deep Night text-readability fixes, mirroring the Dark Mode fixes above. */
body.theme-night.order-page h1,
body.theme-night.order-page .form-section-title,
body.theme-night .order-grid p,
body.theme-night .received-card-header h3,
body.theme-night .accounting-heading h2,
body.theme-night .table-title {
  color: #f1f5f9;
}
body.theme-night.order-page label,
body.theme-night .period-controls label,
body.theme-night .custom-date-inputs label,
body.theme-night .received-money-form label,
body.theme-night .order-grid b,
body.theme-night .order-note b {
  color: #94a3b8;
}
body.theme-night .accounting-heading p {
  color: #94a3b8;
}
body.theme-night .order-note {
  background: rgba(255, 255, 255, .04);
  color: #f1f5f9;
}

@media (max-width: 640px) {
  /* Rudaw font file does not shape Kurdish letters consistently in some mobile browsers. */
  :root { font-family: "Noto Sans Arabic", "Geeza Pro", "Arial", sans-serif; }
  .page-shell { padding: 30px 14px 52px; }
  .warehouse-shell { padding: 20px 12px 52px; }
  .form-card { padding: 26px 19px; border-radius: 18px; }
  h1 { font-size: 1.65rem; }
  .accounting-panel { padding: 18px 14px; border-radius: 18px; }
  .accounting-header { flex-direction: column; gap: 14px; }
  .accounting-grid-cards { grid-template-columns: 1fr; }
  .net-total-banner { flex-direction: column; align-items: flex-start; gap: 6px; }
  .input-btn-wrap { flex-direction: column; max-width: 100%; }
  .input-btn-wrap .primary-button { width: 100%; }
  .filters, .order-grid, .price-result { grid-template-columns: 1fr; }
  .period-controls { align-items: stretch; flex-direction: column; width: 100%; }.period-controls select { width: 100%; }
  .header-content { flex-wrap: wrap; justify-content: center; gap: 10px; padding: 12px 14px; min-height: auto; }
  .brand { flex: 1 1 100%; justify-content: center; text-align: center; font-size: 1.12rem; }
  .header-nav { flex: 1 1 100%; justify-content: center; flex-wrap: wrap; gap: 8px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .dashboard-actions { width: 100%; }
  .dashboard-actions button { flex: 1; }
  .order-card { padding: 19px 17px; }
  .order-top { align-items: flex-start; flex-direction: column; gap: 3px; }
  .order-grid p { flex-direction: column; gap: 3px; }
  .table-wrap { overflow-x: visible; }
  .orders-stats-table { min-width: 0; }
  .orders-stats-table thead { display: none; }
  .orders-stats-table, .orders-stats-table tbody { display: block; width: 100%; }
  .orders-stats-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  .orders-stats-table td {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 6px;
    background: #f8fafc;
    border-radius: 12px;
  }
  .orders-stats-table td::before {
    content: attr(data-label);
    font-size: .74rem;
    font-weight: 800;
    color: #64748b;
  }
  .order-actions { justify-content: stretch; gap: 8px; }
  .order-actions .status-select { flex: 1 1 100%; width: 100%; min-width: 0; order: -1; }
  .order-actions .edit-order-button,
  .order-actions .print-order-button,
  .order-actions .delete-order-button,
  .order-actions .restore-order-button { flex: 1 1 0; min-width: 0; padding: 10px 4px; font-size: .82rem; text-align: center; white-space: nowrap; }
}

@media (max-width: 380px) {
  .order-actions .edit-order-button,
  .order-actions .print-order-button,
  .order-actions .delete-order-button,
  .order-actions .restore-order-button { font-size: 0; padding: 10px 0; }
  .order-actions .edit-order-button::before { content: "✏️"; font-size: 1rem; }
  .order-actions .print-order-button::before { content: "🖨️"; font-size: 1rem; }
  .order-actions .delete-order-button::before { content: "🗑️"; font-size: 1rem; }
  .order-actions .restore-order-button::before { content: "↩️"; font-size: 1rem; }
}

/* ===== Smooth motion: card enter/exit + button press feel ===== */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes overlayEnter {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalEnter {
  from { opacity: 0; transform: translateY(14px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.order-card {
  animation: cardEnter .32s cubic-bezier(.2, .7, .3, 1) both;
  transition: opacity .22s ease, transform .22s ease, max-height .28s ease, margin .28s ease, padding .28s ease;
}
.order-card.card-removing {
  opacity: 0;
  transform: translateX(14px) scale(.97);
  pointer-events: none;
}

.modal-overlay:not(.hidden) {
  animation: overlayEnter .16s ease both;
}
.modal-overlay:not(.hidden) .modal-card {
  animation: modalEnter .26s cubic-bezier(.16, 1, .3, 1) both;
}

/* Press feedback on interactive controls */
.primary-button,
.secondary-button,
.add-product-button,
.remove-product-btn,
.edit-order-button,
.print-order-button,
.delete-order-button,
.restore-order-button,
.close-modal-btn,
.theme-toggle-btn,
.warehouse-link,
.swatch-btn,
.mode-btn,
.reset-accounting-button,
#reset-theme-btn {
  transition: transform .15s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}
.primary-button:active,
.secondary-button:active,
.add-product-button:active,
.remove-product-btn:active,
.edit-order-button:active,
.print-order-button:active,
.delete-order-button:active,
.restore-order-button:active,
.close-modal-btn:active,
.theme-toggle-btn:active,
.warehouse-link:active,
.swatch-btn:active,
.mode-btn:active,
.reset-accounting-button:active,
#reset-theme-btn:active {
  transform: scale(.94);
}

@media (prefers-reduced-motion: reduce) {
  .order-card,
  .modal-overlay:not(.hidden),
  .modal-overlay:not(.hidden) .modal-card {
    animation: none !important;
  }
  .primary-button:active,
  .secondary-button:active,
  .add-product-button:active,
  .remove-product-btn:active,
  .edit-order-button:active,
  .print-order-button:active,
  .delete-order-button:active,
  .restore-order-button:active,
  .close-modal-btn:active,
  .theme-toggle-btn:active,
  .warehouse-link:active,
  .swatch-btn:active,
  .mode-btn:active,
  .reset-accounting-button:active,
  #reset-theme-btn:active {
    transform: none;
  }
}
