/* ui.css — shared UI for all pages (Havi Printing) */
:root{
  --brand:#F1A01F;
  --bg:#0e0e10;
  --panel:rgba(255,255,255,.04);
  --panel2:rgba(0,0,0,.10);
  --line:rgba(255,255,255,.10);
  --line2:rgba(255,255,255,.08);
  --text:#fff;
  --muted:rgba(255,255,255,.70);
  --muted2:rgba(255,255,255,.75);
  --shadow:0 18px 40px rgba(0,0,0,.35);
  --radius:18px;
  --radius-sm:14px;
  --radius-xs:12px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:Poppins,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

/* RTL support */
[dir="rtl"]{
  font-family:"Noto Sans Arabic",Poppins,system-ui,Segoe UI,Arial,sans-serif;
}

/* spacing helpers */
.sp-6{height:6px}
.sp-10{height:10px}
.sp-12{height:12px}
.sp-16{height:16px}

/* text */
.hint,.muted{color:var(--muted);font-size:12px;line-height:1.55}
.label{font-size:12px;color:rgba(255,255,255,.72);margin-bottom:6px}
.title{font-weight:800}
.kpi{font-size:22px;font-weight:800;margin-top:6px}

/* container */
.container{max-width:1160px;margin:0 auto}
.page-pad{padding:16px}
.page-pad-lg{padding:18px}

/* top header / topbar */
.topbar, header{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(14,14,16,.92);
  backdrop-filter: blur(12px);
  border-bottom:1px solid var(--line2);
  padding:12px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.brand{
  display:flex;
  gap:10px;
  align-items:center;
}
.brand img{
  width:38px;height:38px;
  border-radius:12px;
  background:#fff;
  padding:6px;
  object-fit:contain;
}
.brand b{font-size:14px}
.subhead{color:var(--muted);font-size:12px}

/* buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:10px 14px;
  border-radius:var(--radius-sm);
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  white-space:nowrap;
}
.btn:hover{background:rgba(255,255,255,.09)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-primary{
  border-color:rgba(241,160,31,.65);
  background:linear-gradient(135deg, rgba(241,160,31,1), rgba(241,160,31,.72));
  color:#1a1a1a;
}
.btn-danger{
  border-color:rgba(255,80,80,.55);
  background:rgba(255,80,80,.12);
}
.btn-sm{padding:8px 10px;border-radius:12px;font-size:12px}

/* tabs */
.tabsbar{ padding:0 16px 16px; }
.tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.tab{
  padding:10px 14px;
  border-radius:var(--radius-sm);
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:700;
  cursor:pointer;
}
.tab.active{
  border-color:rgba(241,160,31,.55);
  background:rgba(241,160,31,.15);
}

/* layout panels */
.main-2col{
  padding:16px;
  display:grid;
  gap:14px;
  align-items:start;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
}
@media(max-width:980px){
  .main-2col{grid-template-columns:1fr}
}
.panel, .card, .main-2col > *{ min-width:0; }

.panel{
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:var(--radius);
  padding:16px;
  overflow:visible;
}

.card{
  border-radius:var(--radius);
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow:var(--shadow);
  overflow:visible;
}
.pad{padding:16px}

/* forms */
.input{
  width:100%;
  height:48px;
  padding:12px 14px;
  border-radius:var(--radius-sm);
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05);
  color:var(--text);
  outline:none;
  font-family:inherit;
  font-size:14px;
  line-height:1.2;
}
.input:focus{
  border-color: rgba(241,160,31,.75);
  background: rgba(241,160,31,.10);
  box-shadow: 0 0 0 3px rgba(241,160,31,.18);
}
textarea.input{ height:96px; resize:vertical; }

/* tables */
.table{
  width:100%;
  border-collapse:collapse;
  border-radius:14px;
  overflow:visible;
  border:1px solid var(--line);
  background:var(--panel2);
  table-layout:auto;
}
.table th, .table td{
  padding:10px;
  border-bottom:1px solid var(--line2);
  text-align:left;
  white-space:nowrap;
  overflow:visible;
  text-overflow:ellipsis;
}
.table thead th{
  background:rgba(255,255,255,.04);
  color:var(--muted2);
  font-weight:700;
}
[dir="rtl"] .table th, [dir="rtl"] .table td{ text-align:right; }
.table .wrap{ white-space:normal; overflow:visible; text-overflow:clip; }

.table-scroll{
  width:100%;
  overflow-x:auto;
  overflow-y: visible;
  position: relative;
  -webkit-overflow-scrolling:touch;
}

/* list buttons */
.list button{
  width:100%;
  text-align:left;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
  margin:8px 0;
}
.list button.active{
  border-color:rgba(241,160,31,.65);
  background:rgba(241,160,31,.14);
}
[dir="rtl"] .list button{ text-align:right; }

/* finance KPI boxes */
.kpi-box{
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:16px;
  padding:14px;
}

/* modal */
.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.62);
  z-index:9999;
  display:grid;
  place-items:center;
  padding:16px;
}
.modal-card{
  width:min(1180px,100%);
  max-height:92vh;
  overflow:auto;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(180deg, rgba(25,25,26,.98), rgba(18,18,19,.98));
  box-shadow:0 22px 50px rgba(0,0,0,.45);
  color:var(--text);
}
.modal-head{
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.modal-body{padding:16px}
.grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
@media(max-width:980px){ .grid-2{grid-template-columns:1fr} }

/* Custom Dropdown */
.select-wrap{ position:relative; }
.select-wrap select.select,
.select-wrap select.input{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  pointer-events:none;
}
.cdd{ position:relative; width:100%; overflow:visible; }
.cdd-btn{
  width:100%;
  height:48px;
  padding:12px 44px 12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  color:#fff;
  font:inherit;
  font-size:14px;
  line-height:1.2;
  text-align:left;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  cursor:pointer;
}
[dir="rtl"] .cdd-btn{ text-align:right; padding:12px 14px 12px 44px; }
.cdd-label{ color:#fff; font-size:14px; line-height:1.2; }
.cdd-arrow{ flex:0 0 auto; color:rgba(255,255,255,.70); }
.cdd-menu{
  position:absolute;
  top:calc(100% + 8px);
  left:0;
  right:0;
  z-index: 100000;
  isolation: isolate;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(18,18,19,.98);
  box-shadow:0 18px 45px rgba(0,0,0,.45);
  overflow:auto;
  max-height:260px;
  display:none;
  color:#fff;
  font-size:14px;
  line-height:1.2;
}
.cdd.open .cdd-menu{ display:block; }
.cdd-item{
  padding:12px 14px;
  cursor:pointer;
  user-select:none;
  color:#fff !important;
  font-size:14px;
  line-height:1.2;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.cdd-item:hover{ background:rgba(255,255,255,.06); }
.cdd-item[aria-selected="true"]{
  background:rgba(241,160,31,.15);
  border-left:3px solid rgba(241,160,31,.95);
}
[dir="rtl"] .cdd-item[aria-selected="true"]{
  border-left:none;
  border-right:3px solid rgba(241,160,31,.95);
}
/* Vertical layout for Jobs page */
.main-vertical{
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:18px;
}
.panel,
.modal-body,
.main-vertical,
.main-2col{
  overflow: visible !important;
}
/* Floating dropdown portal (renders in body) */
.cdd-float-menu{
  position: fixed;
  z-index: 200000; /* above panels/tables/modals */
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(18,18,19,.98);
  box-shadow: 0 18px 45px rgba(0,0,0,.45);
  overflow: auto;
  max-height: 260px;
  display: none;
}

.cdd-float-menu.open{ display:block; }

.cdd-float-item{
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  color: #fff;
  font-size: 14px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cdd-float-item:hover{ background: rgba(255,255,255,.06); }
.cdd-float-item[aria-selected="true"]{
  background: rgba(241,160,31,.15);
  border-left: 3px solid rgba(241,160,31,.95);
}
[dir="rtl"] .cdd-float-item[aria-selected="true"]{
  border-left: none;
  border-right: 3px solid rgba(241,160,31,.95);
}
/* =========================
   Admin V2 (Owner/Operator)
   ========================= */

.sticky-tabs{
  position: sticky;
  top: 64px;
  z-index: 18;
  background: rgba(14,14,16,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line2);
}

.tabs-scroll{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.tabs-scroll::-webkit-scrollbar{ height: 6px; }
.tabs-scroll::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.12); border-radius: 99px; }

.admin-shell{
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  align-items: start;
}
.admin-main,.admin-side{ min-width: 0; }

/* iPhone / small screens: stack */
@media (max-width: 980px){
  .admin-shell{ grid-template-columns: 1fr; }
  .sticky-tabs{ top: 56px; }
}

/* extra tight (phones) */
@media (max-width: 520px){
  .page-pad, .page-pad-lg, .admin-shell{ padding: 12px; }
  .btn{ padding: 10px 12px; }
  .tab{ padding: 10px 12px; }
  .input{ height: 46px; }
}

/* Board layout (Jobs) */
.board{
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: start;
}
@media(max-width: 980px){
  .board{ grid-template-columns: 1fr; }
}

.board-col{
  border: 1px solid var(--line);
  background: rgba(0,0,0,.10);
  border-radius: 16px;
  overflow: hidden;
}
.board-head{
  padding: 12px 12px;
  border-bottom: 1px solid var(--line2);
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
}
.board-head b{ font-size: 13px; }
.board-body{
  padding: 12px;
  display: grid;
  gap: 10px;
}
.jobcard{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius: 14px;
  padding: 10px 12px;
}
.jobcard .meta{ color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.5; }
.jobcard .row{ display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap; }
.jobcard .pill{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}
.pill.done{ border-color: rgba(90,255,160,.20); background: rgba(90,255,160,.10); }
.pill.prog{ border-color: rgba(241,160,31,.25); background: rgba(241,160,31,.12); }
.pill.pend{ border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.05); }

/* permissions panel */
.perm-grid{
  display:grid;
  gap:10px;
}
.perm-row{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  padding: 10px 12px;
  border-radius: 14px;
}
.perm-row b{ font-size: 13px; }
/* Finance dashboard KPI row */
.kpi-row-4{
  display:grid;
  gap:10px;
  grid-template-columns: repeat(4, minmax(0,1fr));
}
@media (max-width: 980px){
  .kpi-row-4{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px){
  .kpi-row-4{ grid-template-columns: 1fr; }
}

/* Payments modal helpers */
.modal-body .label{ margin-top: 4px; }
.modal-body .tabs{ margin-top: 10px; }

.inv-stack{ display:grid; gap:10px; }
.inv-box{
  width:100%;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255, 255, 255, 0.12);
  cursor:pointer;
  text-align:left;
}
.inv-box:hover{
  border-color: rgba(241,160,31,.40);
  background: #fafaf914;
}
.inv-box-left{ min-width:0; display:grid; gap:4px; }
.inv-box-title{ display:flex; gap:8px; align-items:baseline; flex-wrap:wrap; }
.inv-box-sub{ opacity:.9; }
.inv-box-right{ text-align:right; display:grid; gap:2px; }
.inv-box-total{ font-weight:900; font-size:16px; }
.inv-body{ padding: 0 2px 4px; }

.btn.danger {
  background: #d32f2f;
  color: white;
}

.btn.danger:hover {
  background: #b71c1c;
}

/* Make Qty & Price wider in job table */
.table input[type="number"] {
  width: 120px;
}

.designer-select {
  width: 50px;
}

/* Invoice / Receipt types — NO colored stroke */
.type-invoice{
  border: none;               /* keep normal UI border */
  background: linear-gradient(180deg, rgba(220,38,38,.10), rgba(0,0,0,.15));
  box-shadow: 0 0 0 1px rgba(220,38,38,.10) inset;  /* very soft tint, not a stroke */
}

.type-receipt{
  border: none;               /* keep normal UI border */
  background: linear-gradient(180deg, rgba(37,99,235,.10), rgba(0,0,0,.15));
  box-shadow: 0 0 0 1px rgba(37,99,235,.10) inset;  /* very soft tint */
}

.type-invoice .type-label{ color:#ef4444; font-weight:800; }
.type-receipt .type-label{ color:#3b82f6; font-weight:800; }

/* Ensure invoice & receipt boxes are rounded */
.inv-acc {
  border-radius: 16px;
  overflow: hidden; /* prevents inner content from breaking radius */
}

/* If type classes override anything */
.type-invoice,
.type-receipt {
  border-radius: 16px;
}

.inv-acc {
  border-radius: 18px;
  backdrop-filter: blur(6px);
}

/* ===== Modal Center Fix ===== */

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);

  display: none;              /* hidden by default */
  align-items: center;        /* vertical center */
  justify-content: center;    /* horizontal center */

  z-index: 9999;
}

.modal{
  width: 700px;
  max-width: 95%;
  max-height: 90vh;

  background: #111;
  border-radius: 16px;
  padding: 24px;

  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

/* Force list buttons to stack nicely */
#list #rows .btn{
  width:100%;
  display:flex;
}

.btn-yellow{
  background:#F1A01F;
  color:#111;
  border:none;
  font-weight:700;
}
.btn-yellow:hover{
  background:#ffb733;
}

.row{
  display:flex;
  align-items:center;
}
.row.between{
  justify-content:space-between;
}