@font-face { font-family: 'NRT'; src: url('../fonts/NRT-Regular.woff2') format('woff2'); font-weight: 400 900; font-style: normal; font-display: swap; }

:root {
  --cream: #FFF8F1;
  --coral: #E8663D;
  --coral-dark: #C24B27;
  --pink: #E85D8A;
  --pink-light: #FBE4EC;
  --ink: #3A2A22;
  --ink-soft: #8A796D;
  --card: #FFFFFF;
  --border: #F0E2D3;
  --success: #2F9E6E;
  --success-bg: #E7F5EE;
  --danger: #D64545;
  --danger-bg: #FBEAEA;
  --radius: 18px;
}

* { box-sizing: border-box; }
.ti-users-cog::before { content:"\f9d4"; }

body {
  margin: 0;
  direction: rtl;
  font-family: 'NRT', Tahoma, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
input, button { font-family: inherit; }

/* ---------- Splash screen ---------- */
.splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--coral) 0%, var(--pink) 100%);
  color: #fff;
  text-align: center;
  padding: 24px;
}

.splash-logo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.splash h1 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.splash p { font-size: 14px; font-weight: 400; opacity: 0.9; margin: 0; }

.splash-dots { display: flex; gap: 6px; margin-top: 28px; }
.splash-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; opacity: 0.5;
  animation: dotPulse 1.2s infinite ease-in-out;
}
.splash-dots span:nth-child(2) { animation-delay: 0.15s; }
.splash-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-dots span { animation: none; opacity: 0.8; }
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--coral) 0%, var(--pink) 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.login-card {
  background: var(--cream);
  width: 100%;
  max-width: 420px;
  border-radius: 28px 28px 0 0;
  padding: 36px 24px 32px;
  text-align: center;
}

.login-card .badge {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--pink-light);
  color: var(--coral-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin: -58px auto 18px;
  border: 4px solid var(--cream);
}

.login-card h2 { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.login-card .sub { font-size: 13px; color: var(--ink-soft); margin: 0 0 24px; }

.field { text-align: right; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1.5px solid var(--border); background: #fff;
  font-size: 15px; color: var(--ink); outline: none;
}
.field input:focus { border-color: var(--coral); }

.btn-primary {
  width: 100%; padding: 15px; border: none; border-radius: 14px;
  background: var(--coral); color: #fff; font-size: 15px; font-weight: 600;
  margin-top: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:active { background: var(--coral-dark); }

.error-msg {
  background: var(--danger-bg); color: var(--danger);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}

/* ---------- Branded app entry ---------- */
.splash-body { min-height:100vh; overflow:hidden; background:#10233f; }
.brand-splash { position:relative; display:flex; min-height:100svh; flex-direction:column; align-items:center; justify-content:center; overflow:hidden; padding:32px 24px max(28px,env(safe-area-inset-bottom)); background:radial-gradient(circle at 50% 35%,#28598a 0,#173b62 34%,#10233f 72%); color:#fff; text-align:center; }
.splash-glow { position:absolute; border-radius:50%; filter:blur(2px); opacity:.14; }
.splash-glow.one { top:-90px; right:-80px; width:280px; height:280px; border:1px solid #fff; box-shadow:0 0 0 40px rgba(255,255,255,.12),0 0 0 80px rgba(255,255,255,.08); }
.splash-glow.two { bottom:-120px; left:-100px; width:300px; height:300px; background:#dda434; filter:blur(60px); }
.splash-mark { position:relative; display:flex; width:126px; height:126px; flex-direction:column; align-items:center; justify-content:center; border:2px solid rgba(255,255,255,.78); border-radius:36px; background:linear-gradient(145deg,rgba(255,255,255,.17),rgba(255,255,255,.06)); box-shadow:0 25px 55px rgba(0,0,0,.25),inset 0 1px rgba(255,255,255,.35); animation:splashRise .7s ease both; }
.splash-mark::before { content:''; position:absolute; inset:9px; border:1px solid rgba(255,255,255,.2); border-radius:28px; }
.splash-mark span { font-family:Georgia,serif; font-size:25px; font-weight:900; letter-spacing:4px; }.splash-mark i { width:45px; height:2px; margin:6px 0; background:#e7b54c; }.splash-mark b { font-family:Arial,sans-serif; font-size:9px; letter-spacing:2px; }
.splash-copy { position:relative; margin-top:30px; animation:splashRise .7s .15s ease both; }.splash-copy small { color:#e7b54c; font-size:13px; }.splash-copy h1 { margin:3px 0 7px; font-size:31px; }.splash-copy p { max-width:310px; margin:0; color:rgba(255,255,255,.7); font-size:13px; line-height:1.8; }
.splash-loader { position:relative; width:150px; height:3px; margin-top:36px; overflow:hidden; border-radius:99px; background:rgba(255,255,255,.13); }.splash-loader span { display:block; width:55%; height:100%; border-radius:inherit; background:linear-gradient(90deg,#e7b54c,#fff0bc); animation:splashLoad 2.3s ease-in-out forwards; }
.splash-version { position:absolute; bottom:max(22px,env(safe-area-inset-bottom)); margin:0; color:rgba(255,255,255,.42); font-size:10px; }
@keyframes splashRise { from{opacity:0;transform:translateY(18px) scale(.96)}to{opacity:1;transform:none} } @keyframes splashLoad { from{transform:translateX(190%)}to{transform:translateX(-115%)} }

.login-screen { display:grid; min-height:100svh; grid-template-columns:minmax(280px,.9fr) minmax(390px,1.1fr); background:#f2f5f8; }
.login-brand { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:24px; overflow:hidden; padding:48px; background:radial-gradient(circle at 60% 25%,#285c8e,#173b62 42%,#10233f); color:#fff; text-align:center; }
.login-brand::before,.login-brand::after { content:''; position:absolute; border-radius:50%; }.login-brand::before { top:-120px; right:-120px; width:320px; height:320px; border:1px solid rgba(255,255,255,.12); box-shadow:0 0 0 55px rgba(255,255,255,.04); }.login-brand::after { bottom:-140px; left:-90px; width:300px; height:300px; background:rgba(224,161,36,.13); }
.login-brand-mark { position:relative; z-index:1; display:flex; width:112px; height:112px; flex-direction:column; align-items:center; justify-content:center; border:2px solid rgba(255,255,255,.65); border-radius:32px; background:rgba(255,255,255,.1); box-shadow:0 20px 50px rgba(0,0,0,.22); }.login-brand-mark span { font:900 24px Georgia,serif; letter-spacing:4px; }.login-brand-mark b { margin-top:7px; color:#e9bc61; font:700 9px Arial,sans-serif; letter-spacing:2px; }
.login-brand>div:last-child { position:relative; z-index:1; }.login-brand small { color:#e9bc61; }.login-brand h1 { margin:4px 0 6px; font-size:30px; }.login-brand p { max-width:320px; margin:0; color:rgba(255,255,255,.68); font-size:13px; line-height:1.8; }
.login-panel { width:min(470px,calc(100% - 40px)); margin:auto; padding:36px; border:1px solid #e1e7ed; border-radius:24px; background:#fff; box-shadow:0 24px 65px rgba(16,35,63,.12); }
.login-heading { display:flex; align-items:center; gap:13px; margin-bottom:28px; }.login-welcome { display:flex; width:48px; height:48px; align-items:center; justify-content:center; border-radius:15px; background:#eaf1f8; color:#1b4d7d; font-size:23px; }.login-heading p { margin:0; color:#7a8796; font-size:11px; }.login-heading h2 { margin:1px 0 0; color:#172b46; font-size:22px; }
.login-field { margin-bottom:17px; }.login-field label { display:block; margin-bottom:7px; color:#536276; font-size:12px; font-weight:700; }.login-field>div { position:relative; }.login-field>div>i { position:absolute; top:50%; right:14px; color:#75869a; font-size:18px; transform:translateY(-50%); }.login-field input { width:100%; min-height:52px; padding:12px 43px 12px 46px; border:1.5px solid #dce3ea; border-radius:13px; background:#f9fbfc; color:#172b46; font-size:14px; outline:none; transition:.18s; }.login-field input:focus { border-color:#2b649b; background:#fff; box-shadow:0 0 0 4px rgba(43,100,155,.09); }.password-toggle { position:absolute; top:50%; left:8px; display:flex; width:36px; height:36px; align-items:center; justify-content:center; border:0; border-radius:9px; background:transparent; color:#75869a; font-size:17px; transform:translateY(-50%); cursor:pointer; }
.login-submit { display:flex; width:100%; min-height:52px; align-items:center; justify-content:center; gap:9px; margin-top:7px; border:0; border-radius:13px; background:linear-gradient(115deg,#173b62,#24669e); color:#fff; font:800 14px 'NRT',Tahoma,sans-serif; box-shadow:0 12px 25px rgba(27,77,125,.22); cursor:pointer; }.login-submit:active { transform:translateY(1px); box-shadow:none; }.login-help { margin:20px 0 0; color:#8995a3; font-size:10.5px; text-align:center; }.login-help i { margin-inline-end:4px; color:#2f9e6e; }.login-panel .error-msg { display:flex; align-items:center; gap:7px; border:1px solid #f4cccc; }
@media(max-width:760px){.login-screen{display:flex; flex-direction:column; background:#10233f}.login-brand{min-height:34svh; justify-content:flex-end; flex-direction:row; padding:34px 24px 48px; text-align:right}.login-brand-mark{width:76px;height:76px;min-width:76px;border-radius:23px}.login-brand-mark span{font-size:17px}.login-brand h1{font-size:24px}.login-brand p{display:none}.login-panel{position:relative;width:100%;max-width:none;margin:-22px 0 0;padding:29px 22px max(26px,env(safe-area-inset-bottom));border:0;border-radius:25px 25px 0 0;box-shadow:none;flex:1}.login-heading{margin-bottom:23px}}
@media(prefers-reduced-motion:reduce){.splash-mark,.splash-copy,.splash-loader span{animation:none}}

/* ---------- App shell / dashboard ---------- */
.app { padding-bottom: 84px; min-height: 100vh; }

.topbar {
  background: linear-gradient(160deg, var(--coral) 0%, var(--pink) 100%);
  color: #fff;
  padding: 20px 20px 26px;
  border-radius: 0 0 24px 24px;
}

.topbar-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.topbar .greet { font-size: 13px; opacity: 0.85; margin: 0 0 2px; }
.topbar .shop { font-size: 19px; font-weight: 700; margin: 0 0 18px; display: flex; align-items: center; gap: 8px; }
.topbar .back-link { color: #fff; opacity: 0.9; font-size: 13px; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }

.icon-btn {
  width: 38px; height: 38px; min-width: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.18); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.3); }

.summary-row { display: flex; gap: 12px; }
.summary-box {
  flex: 1; background: rgba(255,255,255,0.16);
  border-radius: 16px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.summary-box .icon-circle {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.summary-box .label { font-size: 11.5px; opacity: 0.85; margin: 0 0 2px; }
.summary-box .value { font-size: 16px; font-weight: 700; margin: 0; }

/* ---------- Menu drawer ---------- */
.menu-backdrop {
  position: fixed; inset: 0; background: rgba(30,20,15,0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 20;
}
.menu-backdrop.show { opacity: 1; pointer-events: auto; }

.menu-drawer {
  position: fixed; top: 0; bottom: 0; right: 0;
  width: 78%; max-width: 300px; background: var(--cream);
  transform: translateX(100%); transition: transform 0.25s ease; z-index: 21;
  padding: 22px 18px; display: flex; flex-direction: column;
}
.menu-drawer.open { transform: translateX(0); }

.menu-drawer .menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.menu-drawer .menu-head span { font-size: 15px; font-weight: 700; }
.menu-drawer .menu-head button {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--ink);
}

.menu-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 10px; border-radius: 12px; font-size: 14.5px; font-weight: 500; color: var(--ink);
}
.menu-link:active { background: var(--pink-light); }
.menu-link .m-icon {
  width: 36px; height: 36px; border-radius: 11px; background: var(--pink-light);
  color: var(--coral-dark); display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.menu-link.danger .m-icon { background: var(--danger-bg); color: var(--danger); }

/* ---------- Floating action button ---------- */
.fab {
  position: fixed; left: 20px; bottom: 96px; z-index: 9;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--coral); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: 0 8px 18px rgba(232,102,61,0.35);
}
.fab:active { background: var(--coral-dark); }

/* ---------- Avatars & input icons ---------- */
.avatar {
  width: 42px; height: 42px; min-width: 42px; border-radius: 50%;
  background: var(--pink-light); color: var(--coral-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}

.field.icon-field { position: relative; }
.field.icon-field i {
  position: absolute; top: 40px; right: 14px; color: var(--ink-soft); font-size: 16px;
}
.field.icon-field input, .field.icon-field select { padding-right: 42px; }

.search-wrap { padding: 16px 20px 4px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
}
.search-box input {
  border: none; outline: none; flex: 1; font-size: 14px;
  background: transparent; color: var(--ink);
}
.search-box i { color: var(--ink-soft); font-size: 18px; }

.section-title {
  font-size: 14px; font-weight: 600; color: var(--ink-soft);
  padding: 18px 20px 8px;
}

/* ---------- Customer card with "scoop" balance badge ---------- */
.customer-list { display: flex; flex-direction: column; gap: 10px; padding: 0 20px; }

.customer-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}

.customer-card .info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.customer-card .name { font-size: 15px; font-weight: 600; margin: 0 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-card .shop { font-size: 12.5px; color: var(--ink-soft); margin: 0; display: flex; align-items: center; gap: 4px; }

/* ---------- Item cards (items_manage.php) ---------- */
.item-icon {
  width: 42px; height: 42px; min-width: 42px; border-radius: 12px;
  background: var(--pink-light); color: var(--coral-dark);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.item-price { font-size: 13px; font-weight: 700; color: var(--coral-dark); white-space: nowrap; }

.scoop-badge {
  min-width: 78px; text-align: center;
  border-radius: 50px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 700;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.scoop-badge.owes { background: var(--danger-bg); color: var(--danger); }
.scoop-badge.clear { background: var(--success-bg); color: var(--success); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font-size: 11px; color: var(--ink-soft);
}
.bottom-nav a i { font-size: 21px; }
.bottom-nav a.active { color: var(--coral); }

/* ---------- V2 usability and responsive layout ---------- */
:root {
  --shadow-sm: 0 8px 24px rgba(66, 39, 27, 0.07);
  --shadow-lg: 0 18px 50px rgba(66, 39, 27, 0.12);
  --content-width: 1120px;
}

html { min-width: 320px; background: #f7eee5; }
body { min-height: 100vh; line-height: 1.5; }
body.menu-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a, input, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(232, 102, 61, 0.3);
  outline-offset: 2px;
}

.app {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  background: var(--cream);
  box-shadow: var(--shadow-lg);
}
.topbar { padding-top: max(20px, env(safe-area-inset-top)); }
.topbar-top { align-items: center; }
.topbar .shop { line-height: 1.35; }
.summary-box { min-width: 0; }
.summary-box > div { min-width: 0; }
.summary-box .value { overflow-wrap: anywhere; }

.page-form {
  width: min(100%, 720px);
  margin-inline: auto;
  padding: 20px;
}
.field label { color: #69584e; font-weight: 600; }
.field input, .field select, .item-row input, .item-row select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}
.field input:hover, .field select:hover, .item-row input:hover, .item-row select:hover { border-color: #dfc8b6; }
.field input:focus, .field select:focus, .item-row input:focus, .item-row select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(232, 102, 61, 0.1);
}
.field input[readonly], .item-row input[readonly] { background: #f8f3ee; color: var(--ink-soft); }

.btn-primary, .btn-secondary {
  min-height: 48px;
  border-radius: 13px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary:hover { box-shadow: 0 8px 18px rgba(232,102,61,.22); transform: translateY(-1px); }
.btn-secondary {
  width: 100%; border: 1.5px dashed #dcae96; background: #fff5ef; color: var(--coral-dark);
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px;
  font-weight: 700; cursor: pointer; margin-bottom: 14px;
}

.customer-card { box-shadow: 0 3px 12px rgba(66,39,27,.035); transition: .18s ease; }
a.customer-card:hover { border-color: #e6c9b6; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.customer-card .info > div { min-width: 0; }
.customer-card .shop { overflow-wrap: anywhere; }
.search-box:focus-within { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(232,102,61,.1); }
.search-box input { min-width: 0; }

.item-rows { display: grid; gap: 12px; margin-bottom: 14px; }
.item-row {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(90px, .8fr) minmax(86px, .7fr) minmax(110px, 1fr) 44px;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.62);
}
.remove-row, .danger-button {
  width: 44px; min-width: 44px; height: 44px; align-self: center; border: 0; border-radius: 12px;
  background: var(--danger-bg); color: var(--danger); cursor: pointer;
}
.remove-row:disabled { opacity: .35; cursor: not-allowed; }
.invoice-total {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 0 18px; padding: 15px 16px; border-radius: 14px;
  background: var(--ink); color: #fff;
}
.invoice-total strong { font-size: 20px; }
.inline-form { margin: 0; }
.logout-form { margin-top: auto; }
.logout-form .menu-link { width: 100%; border: 0; background: transparent; text-align: right; cursor: pointer; }
.collapsible-form[hidden] { display: none; }

.menu-drawer { box-shadow: -16px 0 42px rgba(30,20,15,.16); }
.menu-link:hover { background: var(--pink-light); }
.bottom-nav a { min-height: 52px; justify-content: center; border-radius: 12px; }
.bottom-nav a.active { background: #fff4ee; }
.fab { transition: transform .15s ease, box-shadow .15s ease; }
.fab:hover { transform: translateY(-2px) scale(1.03); }

@media (min-width: 700px) {
  body { padding: 18px; }
  .app { min-height: calc(100vh - 36px); border-radius: 26px; overflow: hidden; padding-bottom: 92px; }
  .topbar { border-radius: 0 0 28px 28px; padding-inline: 30px; }
  .search-wrap, .section-title { padding-inline: 30px; }
  .customer-list { padding-inline: 30px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-list > [style*="text-align:center"] { grid-column: 1 / -1; }
  .page-form { padding: 28px 30px; }
  .bottom-nav { left: 50%; width: min(calc(100% - 36px), var(--content-width)); transform: translateX(-50%); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 28px rgba(66,39,27,.08); }
  .fab { left: max(calc((100vw - var(--content-width)) / 2 + 28px), 28px); }
  .login-wrap { align-items: center; padding: 24px; }
  .login-card { border-radius: 28px; box-shadow: var(--shadow-lg); padding: 42px 34px 34px; }
}

@media (min-width: 1000px) {
  .customer-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-row { max-width: 650px; }
}

@media (max-width: 699px) {
  .item-row { grid-template-columns: 1fr 1fr 44px; }
  .item-row select { grid-column: 1 / -1; }
  .item-row input[name="unit[]"] { grid-column: 1; }
  .item-row input[name="unit_price[]"] { grid-column: 2; }
  .remove-row { grid-column: 3; grid-row: 2; }
}

@media (max-width: 420px) {
  .summary-row { flex-direction: column; }
  .customer-card { align-items: flex-start; flex-wrap: wrap; }
  .customer-card .info { flex: 1 1 100%; }
  .scoop-badge { margin-inline-start: 54px; }
  .item-row { grid-template-columns: 1fr 44px; }
  .item-row input { grid-column: 1; }
  .item-row input[name="unit_price[]"] { grid-column: 1; }
  .remove-row { grid-column: 2; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Desktop workspace correction ---------- */
@media (min-width: 900px) {
  :root { --content-width: 1280px; }

  body {
    min-height: 100vh;
    padding: 24px;
    background:
      radial-gradient(circle at 12% 8%, rgba(232, 93, 138, .08), transparent 25%),
      linear-gradient(135deg, #f7f1eb 0%, #fffaf5 100%);
  }

  .app {
    position: relative;
    min-height: calc(100vh - 48px);
    padding: 0 104px 40px 0;
    border: 1px solid rgba(226, 206, 191, .72);
    border-radius: 30px;
    overflow: hidden;
    background: #fbf8f5;
    box-shadow: 0 24px 70px rgba(83, 52, 37, .11);
  }

  .topbar {
    min-height: 128px;
    padding: 24px 38px;
    border-radius: 0 0 26px 26px;
    background:
      radial-gradient(circle at 12% 20%, rgba(255,255,255,.18) 0 35px, transparent 36px),
      linear-gradient(112deg, #ef6844 0%, #e94f80 100%);
  }

  .topbar .back-link {
    width: max-content;
    margin-bottom: 8px;
    padding: 5px 10px;
    border-radius: 99px;
    background: rgba(255,255,255,.13);
    font-weight: 600;
  }

  .topbar .shop {
    margin: 0;
    font-size: clamp(20px, 2vw, 27px);
    letter-spacing: -.02em;
  }

  .topbar .icon-btn { width: 44px; height: 44px; min-width: 44px; }

  .page-form {
    position: relative;
    width: min(680px, calc(100% - 64px));
    margin: 32px auto 0;
    padding: 28px 30px 30px;
    border: 1px solid #eadbd0;
    border-radius: 22px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 14px 40px rgba(73,45,31,.08);
  }

  .page-form::before {
    content: '';
    position: absolute;
    top: 0;
    right: 30px;
    width: 52px;
    height: 4px;
    border-radius: 0 0 8px 8px;
    background: linear-gradient(90deg, var(--coral), var(--pink));
  }

  .field { margin-bottom: 18px; }
  .field label { margin-bottom: 8px; font-size: 13.5px; }
  .field input, .field select { min-height: 52px; background: #fffdfa; }
  .btn-primary { min-height: 52px; margin-top: 10px; border-radius: 14px; }

  .bottom-nav {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 104px;
    height: auto;
    padding: 24px 12px;
    transform: none;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-left: 1px solid #eadbd0;
    border-radius: 0;
    background: rgba(255,255,255,.9);
    box-shadow: none;
    backdrop-filter: blur(16px);
  }

  .bottom-nav::before {
    content: 'شاد';
    position: absolute;
    top: 28px;
    right: 0;
    left: 0;
    color: var(--coral-dark);
    font-size: 16px;
    font-weight: 800;
    text-align: center;
  }

  .bottom-nav a {
    flex: 0 0 auto;
    min-height: 70px;
    padding: 9px 5px;
    gap: 5px;
    border-radius: 16px;
    font-size: 11px;
  }

  .bottom-nav a i { font-size: 23px; }
  .bottom-nav a:hover { color: var(--coral); background: #fff5ef; }
  .bottom-nav a.active { color: #fff; background: linear-gradient(145deg, var(--coral), #e95578); box-shadow: 0 8px 18px rgba(232,102,61,.24); }

  .customer-list { padding-inline: 36px; }
  .section-title, .search-wrap { padding-inline: 36px; }
  .fab { left: max(42px, calc((100vw - 1280px) / 2 + 42px)); bottom: 42px; }
}

@media (min-width: 900px) and (max-height: 700px) {
  .bottom-nav { gap: 4px; padding-block: 12px; }
  .bottom-nav::before { display: none; }
  .bottom-nav a { min-height: 58px; }
  .page-form { margin-top: 22px; }
}

/* ---------- V3 business UI: slate / blue / amber ---------- */
:root {
  --cream: #f5f7fa;
  --coral: #2563eb;
  --coral-dark: #1d4ed8;
  --pink: #0f2747;
  --pink-light: #e8f0fc;
  --ink: #172033;
  --ink-soft: #667085;
  --card: #ffffff;
  --border: #dfe5ec;
  --success: #18875f;
  --success-bg: #e7f6ef;
  --danger: #c63f45;
  --danger-bg: #fceced;
  --amber: #d99116;
  --amber-bg: #fff4dc;
}

body { background: #edf1f5; color: var(--ink); }
.topbar, .profile-hero { background: linear-gradient(118deg, #10233f 0%, #1c4f83 58%, #2563a7 100%); }
.compact-topbar { min-height: 118px; }
.workspace-content { width: 100%; padding: 28px 32px 36px; }
.narrow-workspace { max-width: 900px; margin-inline: auto; }

.notice-msg { margin-bottom: 18px; padding: 13px 16px; border: 1px solid #b8e2ce; border-radius: 13px; background: var(--success-bg); color: #116b4b; font-weight: 600; }
.dashboard-notice { margin: 16px 20px 0; }
.editor-card, .profile-card {
  padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: #fff;
  box-shadow: 0 10px 30px rgba(26, 42, 66, .065);
}
.editor-card { max-width: 820px; margin: 0 auto 28px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin: 2px 0 0; font-size: 20px; line-height: 1.3; }
.eyebrow { color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.entity-form .btn-primary { max-width: 280px; margin-inline-start: auto; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-field { margin: 0 0 18px; padding: 0; border: 0; }
.choice-field legend { margin-bottom: 8px; color: #475467; font-size: 13px; font-weight: 700; }
.segment-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segment-control label { cursor: pointer; }
.segment-control input { position: absolute; opacity: 0; pointer-events: none; }
.segment-control span { display: flex; min-height: 46px; align-items: center; justify-content: center; padding: 9px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; color: #536174; font-size: 13px; font-weight: 700; }
.segment-control input:checked + span { border-color: var(--coral); background: var(--pink-light); color: var(--coral-dark); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.btn-quiet { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 11px; border: 0; border-radius: 10px; background: #f1f4f7; color: #475467; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-quiet:hover { background: #e7edf3; }
.btn-quiet:disabled { opacity: .4; cursor: not-allowed; }
.danger-text { color: var(--danger); }
.btn-secondary.compact { width: auto; min-height: 40px; margin: 0; padding-inline: 14px; border-style: solid; background: var(--pink-light); }
.list-heading { margin-top: 10px; }

.entity-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.entity-card { padding: 18px; border: 1px solid var(--border); border-radius: 17px; background: #fff; box-shadow: 0 5px 18px rgba(26,42,66,.045); }
.entity-card-head { display: flex; align-items: center; justify-content: space-between; }
.entity-card h3 { margin: 15px 0 12px; font-size: 16px; }
.status-chip, .count-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 4px 9px; border-radius: 99px; background: var(--amber-bg); color: #9a6208; font-size: 10.5px; font-weight: 800; }
.count-badge { min-width: 29px; background: var(--pink-light); color: var(--coral-dark); }
.count-badge.success { background: var(--success-bg); color: var(--success); }
.price-list { display: flex; gap: 8px; }
.price-list span { flex: 1; padding: 9px 10px; border-radius: 10px; background: #f7f9fb; }
.price-list small, .price-list strong { display: block; }
.price-list small { color: var(--ink-soft); font-size: 10px; }
.price-list strong { margin-top: 2px; color: #24344d; font-size: 13px; }
.entity-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 15px; padding-top: 13px; border-top: 1px solid #edf0f3; }
.entity-actions form { margin: 0; }

.invoice-editor { max-width: 860px; }
.line-heading { margin-top: 6px; }
.invoice-lines { display: grid; gap: 13px; margin-bottom: 14px; }
.invoice-line { padding: 15px; border: 1px solid var(--border); border-radius: 16px; background: #f8fafc; }
.invoice-line .field { margin: 0; }
.measurement-group { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.measurement-group[hidden] { display: none; }
.line-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.line-total { margin-inline-end: auto; color: #24344d; font-weight: 800; }

.profile-hero { padding: 22px 34px 30px; color: #fff; border-radius: 0 0 28px 28px; }
.profile-toolbar { display: flex; align-items: center; justify-content: space-between; }
.profile-identity { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.profile-avatar { display: flex; width: 66px; height: 66px; min-width: 66px; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.25); border-radius: 18px; background: rgba(255,255,255,.13); font-size: 25px; font-weight: 800; }
.profile-identity h1 { margin: 0; font-size: 26px; }
.profile-identity p { margin: 3px 0 0; color: rgba(255,255,255,.72); font-size: 13px; }
.profile-identity .greet { margin: 0 0 2px; font-size: 11px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.hero-button { display: inline-flex; min-height: 42px; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 11px; background: #fff; color: #17345c; font-size: 12.5px; font-weight: 800; }
.hero-button.success { background: #1b966a; color: #fff; }
.hero-button.ghost { border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.1); color: #fff; }

.profile-workspace { padding-top: 22px; }
.metric-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.metric-card { display: flex; align-items: center; gap: 13px; min-height: 105px; padding: 17px; border: 1px solid var(--border); border-radius: 17px; background: #fff; }
.metric-card > span { display: flex; width: 42px; height: 42px; align-items: center; justify-content: center; border-radius: 12px; background: var(--pink-light); color: var(--coral); font-size: 20px; }
.metric-card.debt > span { background: var(--amber-bg); color: var(--amber); }
.metric-card.paid > span { background: var(--success-bg); color: var(--success); }
.metric-card small, .metric-card strong, .metric-card em { display: block; }
.metric-card small { color: var(--ink-soft); font-size: 11px; }
.metric-card strong { margin-top: 2px; color: #1d2939; font-size: 18px; }
.metric-card em { margin-top: 2px; color: #98a2b3; font-size: 10px; font-style: normal; }
.profile-layout { display: grid; grid-template-columns: minmax(230px,.7fr) minmax(0,2fr); gap: 15px; margin-top: 15px; align-items: start; }
.contact-card { position: sticky; top: 20px; }
.contact-list { margin: 0; }
.contact-list > div { padding: 12px 0; border-bottom: 1px solid #edf0f3; }
.contact-list dt { color: var(--ink-soft); font-size: 11px; }
.contact-list dt i { margin-inline-end: 4px; color: var(--coral); }
.contact-list dd { margin: 4px 0 0; color: #26364e; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.delete-customer-form { margin-top: 15px; }
.activity-column { display: grid; gap: 15px; }
.activity-list { display: grid; gap: 9px; }
.activity-item { border: 1px solid var(--border); border-radius: 13px; background: #fff; overflow: hidden; }
.activity-item summary { display: grid; grid-template-columns: 40px minmax(0,1fr) auto 20px; align-items: center; gap: 10px; padding: 12px; cursor: pointer; list-style: none; }
.activity-item summary::-webkit-details-marker { display: none; }
.activity-icon { display: flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 11px; background: var(--pink-light); color: var(--coral); font-size: 18px; }
.payment-entry .activity-icon { background: var(--success-bg); color: var(--success); }
.activity-main strong, .activity-main small { display: block; }
.activity-main strong { font-size: 13px; }
.activity-main small { margin-top: 2px; color: var(--ink-soft); font-size: 10.5px; }
.activity-item summary > b { color: #26364e; font-size: 12px; white-space: nowrap; }
.toggle-icon { color: #98a2b3; transition: transform .18s; }
.activity-item[open] .toggle-icon { transform: rotate(180deg); }
.activity-details { padding: 4px 14px 13px; border-top: 1px solid #edf0f3; background: #fafbfd; }
.line-detail { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed #e2e7ed; }
.line-detail strong, .line-detail small { display: block; }
.line-detail strong { font-size: 12px; }.line-detail small { margin-top: 2px; color: var(--ink-soft); font-size: 10px; }
.line-detail b { font-size: 11px; white-space: nowrap; }
.entry-note { margin: 9px 0 0; color: #5f6d80; font-size: 11px; }
.empty-state { padding: 28px; text-align: center; color: #98a2b3; }.empty-state i { font-size: 25px; }.empty-state p { margin: 6px 0 0; font-size: 12px; }

.bottom-nav a.active { color: var(--coral); background: var(--pink-light); }
.menu-link .m-icon, .item-icon, .avatar { background: var(--pink-light); color: var(--coral-dark); }

.form-grid.three-columns { grid-template-columns: repeat(3,minmax(0,1fr)); }
.filter-bar { display:grid; grid-template-columns:repeat(3,minmax(150px,1fr)) auto auto; gap:12px; align-items:end; margin-bottom:18px; padding:16px; border:1px solid var(--border); border-radius:16px; background:#fff; }
.compact-button { min-height:44px; width:auto; padding-inline:18px; }
.data-table-wrap { width:100%; overflow-x:auto; border:1px solid var(--border); border-radius:14px; background:#fff; }
.data-table { width:100%; min-width:680px; border-collapse:collapse; color:#26364e; }
.data-table th { padding:12px 14px; background:#f0f4f8; color:#536276; font-size:11px; text-align:right; white-space:nowrap; }
.data-table td { padding:13px 14px; border-top:1px solid #e8edf2; font-size:12px; vertical-align:middle; }
.data-table tbody tr:hover { background:#f8fafc; }
.table-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.table-person,.table-product { display:flex; align-items:center; gap:10px; }
.table-person small,.table-product small { display:block; color:var(--ink-soft); }
.table-prices { display:grid; gap:3px; }
.empty-cell { padding:30px !important; color:#98a2b3; text-align:center; }
.table-details { position:relative; }
.table-details summary { cursor:pointer; color:#1d5f9e; font-weight:800; list-style:none; }
.table-detail-popover { position:absolute; z-index:5; top:30px; inset-inline-end:0; width:290px; padding:10px 13px; border:1px solid var(--border); border-radius:12px; background:#fff; box-shadow:0 16px 35px rgba(16,35,63,.16); }
.table-detail-popover p { display:flex; justify-content:space-between; gap:12px; margin:0; padding:8px 0; border-bottom:1px dashed #dfe5ec; font-size:11px; }
.report-paper { padding:20px; border:1px solid #d9dee5; border-radius:18px; background:#fffdf8; box-shadow:0 12px 35px rgba(16,35,63,.06); }
.report-paper .metric-grid { margin-bottom:18px; }
.status-pill { display:inline-flex; padding:4px 9px; border-radius:999px; background:#e8f1fb; color:#20598f; font-size:10px; font-weight:800; }
.status-pill.payment { background:var(--success-bg); color:var(--success); }
.pagination { display:flex; justify-content:center; align-items:center; gap:10px; margin:18px 0 4px; }
.pagination a,.pagination span { display:inline-flex; min-height:38px; align-items:center; padding:7px 13px; border:1px solid var(--border); border-radius:10px; background:#fff; color:#24466c; font-size:11px; font-weight:800; }
.check-row { display:flex; align-items:center; gap:9px; margin:5px 0 14px; color:#526174; font-size:12px; }.check-row input{width:18px;height:18px;accent-color:#1d5688}
.employee-nav a { flex:1; }
@media (min-width:900px) {
  .bottom-nav.employee-nav { justify-content:flex-start; gap:10px; padding-top:104px; }
  .bottom-nav.employee-nav a { flex:0 0 auto; width:100%; min-height:70px; }
}
.employee-app { background:#eef3f7; }.employee-hero { padding:26px 22px 55px; border-radius:0 0 28px 28px; background:radial-gradient(circle at 15% 10%,#2d6a9e,#173b62 48%,#10233f); color:#fff; }.employee-hero .greet{margin:0;color:rgba(255,255,255,.72);font-size:12px}.employee-hero h1{margin:3px 0;font-size:27px}.employee-hero p{margin:0;color:#e7bb5d;font-size:12px}.employee-actions{display:grid;max-width:720px;gap:14px;margin:-30px auto 0;padding:0 18px 110px}.employee-action-card{display:grid;grid-template-columns:58px 1fr auto;align-items:center;gap:14px;padding:20px;border:1px solid #dce4eb;border-radius:18px;background:#fff;box-shadow:0 12px 35px rgba(16,35,63,.09)}.employee-action-card>span{display:flex;width:58px;height:58px;align-items:center;justify-content:center;border-radius:16px;background:#e8f1fa;color:#1b568b;font-size:27px}.employee-action-card.payment>span{background:#e8f7f0;color:#24825d}.employee-action-card small{color:#8492a2;font-size:10px}.employee-action-card h2{margin:1px 0 3px;color:#172b46;font-size:18px}.employee-action-card p{margin:0;color:#758396;font-size:11px}.employee-action-card>i{color:#9aa7b5;font-size:20px}.employee-limit-note{display:flex;align-items:flex-start;gap:11px;padding:15px;border:1px solid #e2e8ee;border-radius:14px;background:rgba(255,255,255,.65);color:#647386}.employee-limit-note>i{color:#2d8a65;font-size:22px}.employee-limit-note strong{color:#33465c;font-size:12px}.employee-limit-note p{margin:2px 0 0;font-size:10px}

@media (min-width: 900px) {
  body { background: linear-gradient(135deg,#e9eef4,#f7f9fb); }
  .app { background: #f5f7fa; }
  .topbar { background: linear-gradient(118deg,#10233f,#1c4f83 62%,#2563a7); }
  .page-form { border-color: var(--border); }
  .page-form::before { background: var(--amber); }
  .bottom-nav a.active { color: #fff; background: linear-gradient(145deg,#1d4f86,#2563a7); box-shadow: 0 8px 18px rgba(20,68,116,.23); }
  .bottom-nav::before { color: #183b64; }
}

@media (max-width: 899px) {
  .workspace-content { padding: 20px 16px 100px; }
  .entity-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-layout { grid-template-columns: 1fr; }
  .contact-card { position: static; }
  .filter-bar { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 620px) {
  .form-grid.two-columns, .metric-grid, .entity-grid { grid-template-columns: 1fr; }
  .segment-control { grid-template-columns: 1fr; }
  .profile-hero { padding: 18px 18px 24px; }
  .profile-identity h1 { font-size: 22px; }
  .profile-actions .hero-button { flex: 1; justify-content: center; }
  .editor-card, .profile-card { padding: 17px; border-radius: 16px; }
  .activity-item summary { grid-template-columns: 38px minmax(0,1fr) auto; }
  .activity-item .toggle-icon { display: none; }
  .measurement-group { grid-template-columns: 1fr; }
  .form-grid.three-columns,.filter-bar { grid-template-columns:1fr; }
  .report-paper { padding:12px; }
  .data-table th,.data-table td { padding:10px; }
}
