/* Re-Plan V1 — Main Stylesheet */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #09090e;
  --bg2:     #0f0f18;
  --bg3:     #141420;
  --border:  #1e1e2a;
  --border2: #1a1a26;
  --text:    #e0ddd6;
  --muted:   #555;
  --dim:     #3a3a4a;
  --orange:  #f97316;
  --green:   #10b981;
  --blue:    #3b82f6;
  --purple:  #a855f7;
  --red:     #f43f5e;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: 15px; -webkit-font-smoothing: antialiased; overflow: hidden; }

#app { height: 100%; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; position: relative; overflow: hidden; }

.screen { display: none; flex: 1; flex-direction: column; overflow: hidden; height: 100%; }
.screen.active { display: flex; }

.scroll { flex: 1; overflow-y: auto; padding-bottom: 80px; }
.scroll::-webkit-scrollbar { width: 4px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* TOP BAR */
.topbar { padding: 14px 16px 10px; background: var(--bg); border-bottom: 1px solid var(--border2); flex-shrink: 0; }
.logo { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
.logo-plan { color: var(--orange); }
.logo-sub  { font-size: 10px; color: #333; letter-spacing: .1em; margin-left: 6px; font-weight: 400; }
.topbar-row { display: flex; justify-content: space-between; align-items: flex-start; }
.topbar-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.topbar-meta b { color: var(--orange); }
.admin-topbar { background: #0a0a12; border-bottom: 1px solid #f9731620; padding: 14px 16px; flex-shrink: 0; }
.admin-badge { display: inline-block; font-size: 9px; background: #f9731620; color: var(--orange); border: 1px solid #f9731640; border-radius: 4px; padding: 2px 8px; letter-spacing: .1em; font-weight: 700; margin-left: 8px; }

/* BOTTOM NAV */
.nav { position: absolute; bottom: 0; left: 0; right: 0; background: var(--bg); border-top: 1px solid var(--border2); display: flex; z-index: 50; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px 0 14px; cursor: pointer; position: relative; gap: 3px; color: var(--dim); }
.nav-item.active { color: var(--orange); }
.nav-item.active::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 3px; background: var(--orange); border-radius: 0 0 3px 3px; }
.nav-icon  { font-size: 18px; }
.nav-label { font-size: 8px; letter-spacing: .06em; text-transform: uppercase; color: inherit; }

/* SECTION */
.section-pad { padding: 14px 16px; }
.page-title  { font-size: 18px; font-weight: 700; margin-bottom: 3px; }
.page-sub    { font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.section-header { font-size: 9px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; margin-top: 4px; }

/* CARDS */
.card { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.card-sub   { font-size: 11px; color: var(--muted); }

/* ROW BUTTON */
.row-btn { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; color: var(--text); transition: border-color .15s; }
.row-btn:hover { border-color: var(--dim); }

/* TAGS */
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; padding: 3px 7px; border-radius: 4px; font-weight: 600; letter-spacing: .04em; }
.tag-orange { background: #f9731615; color: var(--orange); border: 1px solid #f9731630; }
.tag-blue   { background: #3b82f615; color: var(--blue);   border: 1px solid #3b82f630; }
.tag-green  { background: #10b98115; color: var(--green);  border: 1px solid #10b98130; }
.tag-purple { background: #a855f715; color: var(--purple); border: 1px solid #a855f730; }
.tag-red    { background: #f43f5e15; color: var(--red);    border: 1px solid #f43f5e30; }
.tag-grey   { background: #88888815; color: #888;          border: 1px solid #88888830; }

/* SHIFT BADGE */
.shift-badge  { font-size: 9px; padding: 2px 6px; border-radius: 3px; font-weight: 700; letter-spacing: .04em; }
.shift-early  { background: #22c55e20; color: #22c55e; }
.shift-mid    { background: #f9731620; color: var(--orange); }
.shift-late   { background: #8b5cf620; color: #8b5cf6; }

/* BUTTONS */
.btn { width: 100%; background: var(--orange); color: #fff; border: none; border-radius: 10px; padding: 14px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; }
.btn:hover    { background: #ea6c0a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { width: 100%; background: transparent; color: var(--orange); border: 1px solid #f9731640; border-radius: 10px; padding: 12px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-sm       { background: var(--orange); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-sm-ghost { background: transparent; color: var(--orange); border: 1px solid #f9731640; border-radius: 8px; padding: 7px 12px; font-size: 11px; cursor: pointer; font-family: inherit; }
.btn-red-sm   { background: transparent; color: var(--red); border: 1px solid #f43f5e30; border-radius: 8px; padding: 7px 12px; font-size: 11px; cursor: pointer; font-family: inherit; }

/* INPUTS */
.inp { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 11px 14px; color: var(--text); font-size: 14px; font-family: inherit; transition: border-color .15s; }
.inp:focus { outline: none; border-color: var(--orange); }
.inp::placeholder { color: var(--dim); }
.sel { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 11px 14px; color: var(--text); font-size: 14px; font-family: inherit; }
.sel:focus { outline: none; border-color: var(--orange); }
textarea.inp { resize: vertical; min-height: 80px; }
.field       { margin-bottom: 14px; }
.field-label { font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.field-hint  { font-size: 10px; color: var(--dim); margin-top: 5px; }
.field-error { font-size: 11px; color: var(--red); margin-top: 5px; }

/* AVATAR */
.avatar    { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }

/* ROLE BADGE */
.role-badge  { font-size: 9px; padding: 2px 8px; border-radius: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.role-admin  { background: #f9731620; color: var(--orange); border: 1px solid #f9731640; }
.role-manager { background: #f9731620; color: var(--orange); border: 1px solid #f9731640; }
.role-member { background: #3b82f620; color: var(--blue);   border: 1px solid #3b82f640; }

/* TASK / PROGRESS */
.task-card { border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #333; background: transparent; color: var(--green); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s, border-color .15s; }
.check-btn.done { background: #10b98120; border-color: var(--green); }
.prog-track { height: 3px; background: var(--border2); border-radius: 2px; overflow: hidden; }
.prog-fill  { height: 100%; border-radius: 2px; transition: width .3s; }

/* MEMBER TASK */
.member-task { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 8px; transition: opacity .2s; }
.member-task.done-task { opacity: .55; }
.member-task-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.member-task-meta  { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }

/* DIVIDER */
.divider { border: none; border-top: 1px solid var(--border2); margin: 16px 0; }

/* CHIPS */
.selector-row { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.selector-row::-webkit-scrollbar { display: none; }
.sel-chip { padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; border: 1px solid var(--border); background: var(--bg3); color: var(--dim); transition: all .15s; flex-shrink: 0; }
.sel-chip.active { background: #f9731620; color: var(--orange); border-color: #f9731640; }

/* FAB */
.fab { position: absolute; bottom: 72px; right: 16px; width: 52px; height: 52px; border-radius: 50%; background: var(--orange); color: #fff; border: none; font-size: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(249,115,22,.4); z-index: 40; transition: background .15s; }
.fab:hover { background: #ea6c0a; }

/* SHEET / OVERLAY */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; align-items: flex-end; justify-content: center; }
.overlay.show { display: flex; }
.sheet { background: var(--bg2); border-radius: 20px 20px 0 0; padding: 20px 20px 48px; width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; }
.sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.sheet-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
.sheet-close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; }

/* TOAST */
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 10px 18px; font-size: 13px; font-weight: 600; z-index: 300; pointer-events: none; opacity: 0; transition: opacity .2s; white-space: nowrap; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; }
.toast.toast-green { border-color: #10b98140; color: var(--green); }
.toast.toast-red   { border-color: #f43f5e40; color: var(--red); }

/* MISC */
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border2); }
.stat-row:last-child { border-bottom: none; }
.log-entry { padding: 10px 0; border-bottom: 1px solid var(--border2); font-size: 12px; }
.log-entry:last-child { border-bottom: none; }
.log-actor { color: var(--orange); font-weight: 600; }
.log-time  { color: #444; font-size: 10px; margin-top: 2px; }

/* LOGIN */
#screen-login { background: var(--bg); overflow-y: auto; }
.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; min-height: 100%; }
.login-logo { font-size: 36px; font-weight: 900; margin-bottom: 6px; }
.login-sub  { font-size: 12px; color: #444; margin-bottom: 36px; letter-spacing: .06em; text-transform: uppercase; }

/* PRIVACY / CHANGE PW */
#screen-privacy, #screen-change-password { background: var(--bg); overflow-y: auto; }
.privacy-wrap, .change-pw-wrap { padding: 32px 24px; }
.privacy-body { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 16px; font-size: 12px; color: var(--muted); line-height: 1.7; margin-bottom: 20px; max-height: 260px; overflow-y: auto; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; color: var(--dim); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.empty-sub  { font-size: 12px; color: var(--muted); }

/* SPINNER */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--orange); border-radius: 50%; animation: spin .6s linear infinite; margin: 32px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* COLOUR SWATCHES */
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.swatch.selected { border-color: #fff; }

/* NOTE */
.note-inp { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 12px; font-family: inherit; resize: none; }
.note-inp:focus { outline: none; border-color: var(--orange); }

/* DISTRIBUTION SCREEN */
.dist-drop-zone { border: 2px dashed var(--border2); border-radius: 10px; padding: 28px 16px; text-align: center; cursor: pointer; color: var(--muted); font-size: 13px; transition: border-color .15s, color .15s; }
.dist-drop-zone:hover { border-color: #6366f1; color: var(--text); }
.dist-summary-bar { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-bottom: 12px; padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; }
.dist-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dist-table th { text-align: left; padding: 6px 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.dist-table td { padding: 7px 8px; border-bottom: 1px solid var(--border2); vertical-align: top; }
.dist-table tr:last-child td { border-bottom: none; }

/* FLAGGED DELIVERY BANNER */
.flag-banner { background: #f9731612; border: 1px solid #f9731640; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flag-banner-text { font-size: 13px; font-weight: 600; color: #f97316; }
.flag-banner-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
