/* ===== DK Sales - Flutter/Material Design System ===== */
:root {
  --green: #00A651;          /* primary Material green from video */
  --green-dark: #009149;
  --green-deep: #2E7D32;
  --green-light: #E8F7EF;    /* light green pill / box */
  --green-lighter: #F3EEF5;  /* faint pinkish-gray card bg */
  --bg: #ECEFF1;             /* scaffold background */
  --card-bg: #FBF7FB;
  --white: #FFFFFF;
  --text: #212121;
  --text-muted: #757575;
  --text-light: #9E9E9E;
  --blue: #1565C0;
  --divider: #ECECEC;
  --red: #E53935;
  --shadow: 0 1px 3px rgba(0,0,0,0.10);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Roboto', 'Noto Naskh Arabic', sans-serif;
  background: #000;
  color: var(--text);
  overflow: hidden;
}
[dir="rtl"], .urdu { font-family: 'Noto Naskh Arabic', 'Roboto', sans-serif; }

/* Phone frame - centers the app like a device */
#app {
  max-width: 460px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0,0,0,0.4);
}

/* ===== App Bar ===== */
.appbar {
  background: var(--white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 5;
}
.appbar h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.appbar .actions { display: flex; align-items: center; gap: 18px; }
.appbar .icon-btn { font-size: 20px; color: var(--green); background: none; border: none; cursor: pointer; }
.appbar .back-btn { font-size: 20px; color: var(--text); background: none; border: none; cursor: pointer; margin-right: 8px; }
.appbar .new-btn { color: var(--green); font-weight: 700; font-size: 17px; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 4px; }

/* ===== Scroll body ===== */
.screen-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pad { padding: 16px; }

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-row { display: flex; gap: 12px; }
.stat-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card .label { color: var(--green); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.stat-card .value { font-size: 22px; font-weight: 700; color: var(--text); }

.info-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
}
.info-card .title { color: var(--green); font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.info-card .big { font-size: 20px; font-weight: 700; }

/* ===== Buttons ===== */
.btn {
  width: 100%;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn:active { background: var(--green-dark); }
.btn-grey { background: #BDBDBD; }
.btn-grey:active { background: #9E9E9E; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  display: flex;
  background: var(--white);
  border-top: 1px solid #EEE;
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 6px 0 calc(4px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  color: var(--text-light);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}
.nav-item i { font-size: 20px; }
.nav-item span { font-size: 12px; font-weight: 500; }
.nav-item.active { color: var(--green); }

/* ===== Dashboard ===== */
.welcome-wrap { text-align: center; padding: 18px 16px 8px; }
.welcome-wrap .hello { font-size: 30px; font-weight: 900; color: var(--text); }
.welcome-wrap .name { font-size: 24px; font-weight: 700; color: var(--green); margin-top: 4px; }
.welcome-wrap .sub { color: var(--text-muted); font-size: 16px; margin-top: 10px; }
.sync-btn {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  width: 100%;
  margin: 16px 0 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: inherit;
}

/* ===== Toggle segmented ===== */
.segmented {
  display: inline-flex;
  background: var(--green-light);
  border-radius: 30px;
  padding: 4px;
  margin: 0 auto;
}
.seg-wrap { display: flex; justify-content: center; margin: 16px 0; }
.segmented button {
  border: none;
  background: none;
  padding: 10px 26px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
  cursor: pointer;
  font-family: inherit;
}
.segmented button.active { background: var(--green); color: #fff; }

/* ===== Customer / list cards ===== */
.dashed-sep { border: none; border-top: 2px dashed var(--green); opacity: .4; margin: 6px 16px 14px; }
.search-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 4px; }
.search-row .area { font-size: 17px; font-weight: 500; }
.search-box { display: none; padding: 0 16px 8px; }
.search-box input {
  width: 100%; padding: 12px 14px; border: 1px solid #E0E0E0; border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff;
}
.search-box.open { display: block; }

.cust-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 16px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.cust-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green-light); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0; margin-top: 4px;
}
.cust-body { flex: 1; text-align: right; }
.cust-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.cust-meta { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.cust-visit { font-size: 13px; margin-top: 4px; }
.cust-visit b { color: var(--green); font-weight: 600; }
.bal-box {
  background: var(--green-light);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 15px;
  min-width: 68px;
  text-align: center;
  align-self: center;
}
.bal-box.zero { background: #EFEFEF; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 15px; font-weight: 500; margin-bottom: 8px; color: var(--text); }
.form-group label .req { color: var(--red); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 14px; border: 1px solid #D0D0D0; border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--green); }

/* ===== Empty state ===== */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-light);
}
.empty .circle {
  width: 220px; height: 220px; border-radius: 50%; background: #E4E1DE;
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.empty .circle i { font-size: 90px; color: #CFCBC7; }
.empty .msg { font-size: 20px; color: #9AA0A6; margin-bottom: 24px; }

/* ===== Invoice list ===== */
.inv-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border-radius: var(--radius);
  padding: 14px; margin: 0 16px 10px;
}
.inv-check { color: var(--green); font-size: 22px; }
.inv-body { flex: 1; }
.inv-title { font-size: 15px; font-weight: 600; text-align: right; }
.inv-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ===== Detail summary ===== */
.detail-summary {
  background: var(--card-bg); border-radius: var(--radius); padding: 16px;
  margin: 16px; display: flex; gap: 12px; align-items: flex-start;
}

/* ===== Settings list ===== */
.settings-list { padding: 8px 0; }
.set-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; background: var(--white);
  border-bottom: 1px solid var(--divider); cursor: pointer;
}
.set-item .s-icon {
  width: 38px; height: 38px; border-radius: 8px; background: var(--green-light);
  color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.set-item .s-label { flex: 1; font-size: 16px; font-weight: 500; }
.set-item .s-val { color: var(--text-muted); font-size: 14px; }
.set-item .chev { color: var(--text-light); font-size: 15px; }

/* ===== Report tables ===== */
.report-head { text-align: center; padding: 16px; background: var(--card-bg); border-radius: var(--radius); margin: 16px; }
.report-head .co { font-size: 18px; font-weight: 700; }
.report-head .cell { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.report-head .meta { font-size: 13px; margin-top: 6px; color: var(--green); }
.sum-list { margin: 0 16px 16px; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; }
.sum-row { display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--divider); font-size: 15px; }
.sum-row:last-child { border-bottom: none; }
.sum-row b { font-weight: 700; }
.data-table { margin: 0 16px 16px; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; font-size: 13px; }
.data-table .thead, .data-table .trow { display: flex; }
.data-table .thead { background: var(--green); color: #fff; font-weight: 600; }
.data-table .trow { border-bottom: 1px solid var(--divider); }
.data-table .cellx { flex: 1; padding: 10px 6px; text-align: center; }
.data-table .cellx.name { flex: 1.6; text-align: left; }

/* ===== Product card ===== */
.prod-card { background: var(--card-bg); border-radius: var(--radius); padding: 14px; margin: 0 16px 12px; }
.prod-top { display: flex; justify-content: space-between; align-items: center; }
.prod-name { font-size: 16px; font-weight: 700; }
.prod-desc { font-size: 13px; color: var(--text-muted); margin: 6px 0; }
.prod-line { font-size: 13px; color: var(--green); }

/* ===== Options menu (bottom sheet) ===== */
.sheet-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.4); z-index: 20;
  display: flex; align-items: flex-end;
}
.sheet {
  background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 8px 0 16px;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet .grip { width: 40px; height: 4px; background: #DDD; border-radius: 2px; margin: 8px auto 4px; }
.sheet .opt {
  padding: 15px 22px; font-size: 16px; border-bottom: 1px solid var(--divider); cursor: pointer;
  display: flex; align-items: center; gap: 14px;
}
.sheet .opt:last-child { border-bottom: none; }
.sheet .opt i { color: var(--green); width: 22px; text-align: center; }

/* ===== Login ===== */
.login-screen {
  height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: 30px; background: var(--white);
}
.login-logo {
  width: 90px; height: 90px; border-radius: 22px; background: var(--green);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 42px;
  margin: 0 auto 18px;
}
.login-title { text-align: center; font-size: 26px; font-weight: 900; }
.login-sub { text-align: center; color: var(--text-muted); margin: 6px 0 30px; }
.login-hint { text-align: center; font-size: 13px; color: var(--text-light); margin-top: 16px; }
.err-msg { color: var(--red); font-size: 14px; text-align: center; margin-bottom: 10px; min-height: 18px; }

/* ===== Toast ===== */
.toast {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: #323232; color: #fff; padding: 12px 20px; border-radius: 24px;
  font-size: 14px; z-index: 50; opacity: 0; transition: opacity .3s; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* dialog */
.dialog-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialog { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 340px; }
.dialog h3 { font-size: 18px; margin-bottom: 14px; }
.dialog .row { display: flex; gap: 10px; margin-top: 16px; }
.dialog .row .btn { flex: 1; padding: 12px; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
